2021-07-26 21:32:50

by Steve French

[permalink] [raw]
Subject: [PATCH][SMB3] fix static analysis warning in smb3_simple_fallocate_write_range

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 <[email protected]>
Signed-off-by: Steve French <[email protected]>

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


Attachments:
0001-smb3-rc-uninitialized-in-one-fallocate-path.patch (929.00 B)

2021-07-26 22:19:03

by Paulo Alcantara

[permalink] [raw]
Subject: Re: [PATCH][SMB3] fix static analysis warning in smb3_simple_fallocate_write_range

Steve French <[email protected]> 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 <[email protected]>
> Signed-off-by: Steve French <[email protected]>
>
> 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) <[email protected]>