diff mbox series

[SMB3] fix static analysis warning in smb3_simple_fallocate_write_range

Message ID CAH2r5mv-HDPQ0XUTsH8e8xVJtfgcB12i=Yk1RiHZo2EJUOQHFQ@mail.gmail.com (mailing list archive)
State New, archived
Headers show
Series [SMB3] fix static analysis warning in smb3_simple_fallocate_write_range | expand

Commit Message

Steve French July 26, 2021, 9:30 p.m. UTC
Clang detected a problem with rc possibly being unitialized
    (when length is zero) in a recently added fallocate code path.

    Reported-by: kernel test robot <lkp@intel.com>
    Signed-off-by: Steve French <stfrench@microsoft.com>

        io_parms.netfid = cfile->fid.netfid;

Comments

Paulo Alcantara July 26, 2021, 10:09 p.m. UTC | #1
Steve French <smfrench@gmail.com> writes:

>     Clang detected a problem with rc possibly being unitialized
>     (when length is zero) in a recently added fallocate code path.
>
>     Reported-by: kernel test robot <lkp@intel.com>
>     Signed-off-by: Steve French <stfrench@microsoft.com>
>
> diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c
> index 23d6f4d71649..2dfd0d8297eb 100644
> --- a/fs/cifs/smb2ops.c
> +++ b/fs/cifs/smb2ops.c

Reviewed-by: Paulo Alcantara (SUSE) <pc@cjr.nz>
diff mbox series

Patch

From 53af3cc8f10f0a0356abd6676028e187ce507689 Mon Sep 17 00:00:00 2001
From: Steve French <stfrench@microsoft.com>
Date: Mon, 26 Jul 2021 16:22:55 -0500
Subject: [PATCH] smb3: rc uninitialized in one fallocate path

Clang detected a problem with rc possibly being unitialized
(when length is zero) in a recently added fallocate code path.

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
---
 fs/cifs/smb2ops.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c
index 23d6f4d71649..2dfd0d8297eb 100644
--- a/fs/cifs/smb2ops.c
+++ b/fs/cifs/smb2ops.c
@@ -3617,7 +3617,8 @@  static int smb3_simple_fallocate_write_range(unsigned int xid,
 					     char *buf)
 {
 	struct cifs_io_parms io_parms = {0};
-	int rc, nbytes;
+	int nbytes;
+	int rc = 0;
 	struct kvec iov[2];
 
 	io_parms.netfid = cfile->fid.netfid;
-- 
2.30.2