From: Anna Schumaker <anna@kernel.org>
To: linux-nfs@vger.kernel.org, trond.myklebust@hammerspace.com
Cc: anna@kernel.org, krzysztof.kozlowski@linaro.org
Subject: [PATCH v5 1/5] NFSv4.2: Fix READ_PLUS smatch warnings
Date: Mon, 17 Jul 2023 16:52:35 -0400 [thread overview]
Message-ID: <20230717205239.921002-2-anna@kernel.org> (raw)
In-Reply-To: <20230717205239.921002-1-anna@kernel.org>
From: Anna Schumaker <Anna.Schumaker@Netapp.com>
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: d3b00a802c845 ("NFS: Replace the READ_PLUS decoding code")
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
---
fs/nfs/nfs42xdr.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/fs/nfs/nfs42xdr.c b/fs/nfs/nfs42xdr.c
index 95234208dc9e..d0919c5bf61c 100644
--- a/fs/nfs/nfs42xdr.c
+++ b/fs/nfs/nfs42xdr.c
@@ -1056,13 +1056,12 @@ static int decode_read_plus(struct xdr_stream *xdr, struct nfs_pgio_res *res)
res->eof = be32_to_cpup(p++);
segments = be32_to_cpup(p++);
if (segments == 0)
- return status;
+ return 0;
segs = kmalloc_array(segments, sizeof(*segs), GFP_KERNEL);
if (!segs)
return -ENOMEM;
- status = -EIO;
for (i = 0; i < segments; i++) {
status = decode_read_plus_segment(xdr, &segs[i]);
if (status < 0)
--
2.41.0
next prev parent reply other threads:[~2023-07-17 20:53 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-17 20:52 [PATCH v5 0/5] NFSv4.2: Various READ_PLUS fixes Anna Schumaker
2023-07-17 20:52 ` Anna Schumaker [this message]
2023-07-17 20:52 ` [PATCH v5 2/5] NFSv4.2: Fix READ_PLUS size calculations Anna Schumaker
2023-07-17 20:52 ` [PATCH v5 3/5] NFSv4.2: Rework scratch handling for READ_PLUS (again) Anna Schumaker
2023-07-17 20:52 ` [PATCH v5 4/5] SUNRPC: kmap() the xdr pages during decode Anna Schumaker
2023-07-18 14:03 ` Chuck Lever
2023-07-18 14:22 ` Anna Schumaker
2023-07-17 20:52 ` [PATCH v5 5/5] NFS: Enable the READ_PLUS operation by default Anna Schumaker
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230717205239.921002-2-anna@kernel.org \
--to=anna@kernel.org \
--cc=krzysztof.kozlowski@linaro.org \
--cc=linux-nfs@vger.kernel.org \
--cc=trond.myklebust@hammerspace.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).