Skip to content

Commit bb05a61

Browse files
committed
NFSv4.2: Fix READ_PLUS smatch warnings
Smatch reports: fs/nfs/nfs42xdr.c:1131 decode_read_plus() warn: missing error code? 'status' Which Dan suggests to fix by doing a hardcoded "return 0" from the "if (segments == 0)" check. Additionally, smatch reports that the "status = -EIO" assignment is not used. This patch addresses both these issues. Reported-by: kernel test robot <lkp@intel.com> Reported-by: Dan Carpenter <error27@gmail.com> Closes: https://lore.kernel.org/r/202305222209.6l5VM2lL-lkp@intel.com/ Fixes: d3b00a8 ("NFS: Replace the READ_PLUS decoding code") Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
1 parent 53663f4 commit bb05a61

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

fs/nfs/nfs42xdr.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1056,13 +1056,12 @@ static int decode_read_plus(struct xdr_stream *xdr, struct nfs_pgio_res *res)
10561056
res->eof = be32_to_cpup(p++);
10571057
segments = be32_to_cpup(p++);
10581058
if (segments == 0)
1059-
return status;
1059+
return 0;
10601060

10611061
segs = kmalloc_array(segments, sizeof(*segs), GFP_KERNEL);
10621062
if (!segs)
10631063
return -ENOMEM;
10641064

1065-
status = -EIO;
10661065
for (i = 0; i < segments; i++) {
10671066
status = decode_read_plus_segment(xdr, &segs[i]);
10681067
if (status < 0)

0 commit comments

Comments
 (0)