Validate log level provided to logger.
Check if provided log level isn't greater than number of available log levels Prevoius check was comparing log level to size of array with avaiable log levels (in bytes). Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
This commit is contained in:
parent
5f81173844
commit
8e64392298
@ -314,7 +314,7 @@ static int _cas_ctx_logger_print(ocf_logger_t logger, ocf_logger_lvl_t lvl,
|
|||||||
[log_debug] = KERN_DEBUG,
|
[log_debug] = KERN_DEBUG,
|
||||||
};
|
};
|
||||||
char *format;
|
char *format;
|
||||||
if (((unsigned)lvl) >= sizeof(level))
|
if (((unsigned)lvl) >= sizeof(level)/sizeof(level[0]))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
format = kasprintf(GFP_ATOMIC, "%s%s", level[lvl], fmt);
|
format = kasprintf(GFP_ATOMIC, "%s%s", level[lvl], fmt);
|
||||||
|
Loading…
Reference in New Issue
Block a user