This patch suppresses SVACE warnings shown below and makes the code more
robust. The actual sign extension issue cannot happen in current code as
value of the len variable in function logger_set_tag() is limited to
LOGGER_ENTRY_MAX_PAYLOAD and create_log() is being called only with fixed
size argument values.
* SIGNED_TO_BIGGER_UNSIGNED: Assignment of a signed value which has type 'int' to a variable of a bigger integer type 'size_t'
Sign extension at linux-rpi3/drivers/staging/android/logger.c:898
* SIGNED_TO_BIGGER_UNSIGNED: Assignment of a signed value which has type 'int' to a variable of a bigger integer type 'size_t'
Sign extension at linux-rpi3/drivers/staging/android/logger.c:1045
Change-Id: I8646555e1a09fb0feb4c12961965aea36c80cd38
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
static long logger_set_tag(struct logger_writer *writer, void __user *arg)
{
struct logger_set_tag tag;
- int len;
+ size_t len;
char *p, *q;
if (copy_from_user(&tag, arg, sizeof(struct logger_set_tag)))
* Log size must must be a power of two, and greater than
* (LOGGER_ENTRY_MAX_PAYLOAD + sizeof(struct logger_entry)).
*/
-static int __init create_log(char *log_name, int size)
+static int __init create_log(char *log_name, size_t size)
{
int ret = 0;
struct logger_log *log;