linux-cifs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH][SMB3] fix static analysis warning in smb3_simple_fallocate_write_range
@ 2021-07-26 21:30 Steve French
  2021-07-26 22:09 ` Paulo Alcantara
  0 siblings, 1 reply; 2+ messages in thread
From: Steve French @ 2021-07-26 21:30 UTC (permalink / raw)
  To: CIFS; +Cc: LKML, ronnie sahlberg

[-- Attachment #1: Type: text/plain, Size: 728 bytes --]

    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
@@ -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;


-- 
Thanks,

Steve

[-- Attachment #2: 0001-smb3-rc-uninitialized-in-one-fallocate-path.patch --]
[-- Type: text/x-patch, Size: 929 bytes --]

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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH][SMB3] fix static analysis warning in smb3_simple_fallocate_write_range
  2021-07-26 21:30 [PATCH][SMB3] fix static analysis warning in smb3_simple_fallocate_write_range Steve French
@ 2021-07-26 22:09 ` Paulo Alcantara
  0 siblings, 0 replies; 2+ messages in thread
From: Paulo Alcantara @ 2021-07-26 22:09 UTC (permalink / raw)
  To: Steve French, CIFS; +Cc: LKML, ronnie sahlberg

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>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-07-26 22:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-26 21:30 [PATCH][SMB3] fix static analysis warning in smb3_simple_fallocate_write_range Steve French
2021-07-26 22:09 ` Paulo Alcantara

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).