Commit bb05a617 authored by Anna Schumaker's avatar Anna Schumaker

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: default avatarkernel test robot <lkp@intel.com>
Reported-by: default avatarDan Carpenter <error27@gmail.com>
Closes: https://lore.kernel.org/r/202305222209.6l5VM2lL-lkp@intel.com/
Fixes: d3b00a80 ("NFS: Replace the READ_PLUS decoding code")
Signed-off-by: default avatarAnna Schumaker <Anna.Schumaker@Netapp.com>
parent 53663f41
...@@ -1056,13 +1056,12 @@ static int decode_read_plus(struct xdr_stream *xdr, struct nfs_pgio_res *res) ...@@ -1056,13 +1056,12 @@ static int decode_read_plus(struct xdr_stream *xdr, struct nfs_pgio_res *res)
res->eof = be32_to_cpup(p++); res->eof = be32_to_cpup(p++);
segments = be32_to_cpup(p++); segments = be32_to_cpup(p++);
if (segments == 0) if (segments == 0)
return status; return 0;
segs = kmalloc_array(segments, sizeof(*segs), GFP_KERNEL); segs = kmalloc_array(segments, sizeof(*segs), GFP_KERNEL);
if (!segs) if (!segs)
return -ENOMEM; return -ENOMEM;
status = -EIO;
for (i = 0; i < segments; i++) { for (i = 0; i < segments; i++) {
status = decode_read_plus_segment(xdr, &segs[i]); status = decode_read_plus_segment(xdr, &segs[i]);
if (status < 0) if (status < 0)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment