summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSylwester Nawrocki <s.nawrocki@samsung.com>2021-05-18 14:26:51 +0200
committerSylwester Nawrocki <s.nawrocki@samsung.com>2021-05-18 14:38:34 +0200
commit56a67724efeaee05e76ca6cb75c3ab48f142735f (patch)
tree9d150178b5334c7a79f7e280862170d8dae67136
parentab562dc04ced52021ec709643282bfadafeedd21 (diff)
downloadlinux-rpi3-56a67724efeaee05e76ca6cb75c3ab48f142735f.tar.gz
linux-rpi3-56a67724efeaee05e76ca6cb75c3ab48f142735f.tar.bz2
linux-rpi3-56a67724efeaee05e76ca6cb75c3ab48f142735f.zip
logger: Suppress SVACE sign extension warnings
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>
-rw-r--r--drivers/staging/android/logger.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/staging/android/logger.c b/drivers/staging/android/logger.c
index 14fb7f738adc..ba336bd2ce3b 100644
--- a/drivers/staging/android/logger.c
+++ b/drivers/staging/android/logger.c
@@ -873,7 +873,7 @@ static long logger_set_prio(struct logger_writer *writer, void __user *arg)
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)))
@@ -1010,7 +1010,7 @@ static const struct file_operations logger_fops = {
* 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;