ksmbd: fix read of uninitialized variable ret in set_file_basic_info
authorNamjae Jeon <linkinjeon@kernel.org>
Mon, 6 Sep 2021 23:15:21 +0000 (08:15 +0900)
committerSteve French <stfrench@microsoft.com>
Wed, 8 Sep 2021 22:16:09 +0000 (17:16 -0500)
Addresses-Coverity reported Uninitialized variables warninig :

/fs/ksmbd/smb2pdu.c: 5525 in set_file_basic_info()
5519                    if (!rc) {
5520                            inode->i_ctime = ctime;
5521                            mark_inode_dirty(inode);
5522                    }
5523                    inode_unlock(inode);
5524            }
>>>     CID 1506805:  Uninitialized variables  (UNINIT)
>>>     Using uninitialized value "rc".
5525            return rc;
5526     }
5527
5528     static int set_file_allocation_info(struct ksmbd_work *work,
5529                                 struct ksmbd_file *fp, char *buf)
5530     {

Addresses-Coverity: ("Uninitialized variable")
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/ksmbd/smb2pdu.c

index a350e1c..c86164d 100644 (file)
@@ -5444,7 +5444,7 @@ static int set_file_basic_info(struct ksmbd_file *fp, char *buf,
        struct file *filp;
        struct inode *inode;
        struct user_namespace *user_ns;
-       int rc;
+       int rc = 0;
 
        if (!(fp->daccess & FILE_WRITE_ATTRIBUTES_LE))
                return -EACCES;