]> www.infradead.org Git - nvme.git/commitdiff
lockdown: initialize local array before use to quiet static analysis
authorTanya Agarwal <tanyaagarwal25699@gmail.com>
Sun, 5 Jan 2025 07:05:38 +0000 (12:35 +0530)
committerPaul Moore <paul@paul-moore.com>
Sun, 5 Jan 2025 17:48:43 +0000 (12:48 -0500)
The static code analysis tool "Coverity Scan" pointed the following
details out for further development considerations:

  CID 1486102: Uninitialized scalar variable (UNINIT)
  uninit_use_in_call: Using uninitialized value *temp when calling
                      strlen.

Signed-off-by: Tanya Agarwal <tanyaagarwal25699@gmail.com>
[PM: edit/reformat the description, subject line]
Signed-off-by: Paul Moore <paul@paul-moore.com>
security/lockdown/lockdown.c

index f2bdbd55aa2bc3797963d2b4d3ece14a822b8466..cf83afa1d879ad8b557265e915962d82d1c0305e 100644 (file)
@@ -96,7 +96,7 @@ static int __init lockdown_lsm_init(void)
 static ssize_t lockdown_read(struct file *filp, char __user *buf, size_t count,
                             loff_t *ppos)
 {
-       char temp[80];
+       char temp[80] = "";
        int i, offset = 0;
 
        for (i = 0; i < ARRAY_SIZE(lockdown_levels); i++) {