Linux NFS development
 help / color / mirror / Atom feed
* [PATCH v3 1/3] NFSv4.2: Fix READ_PLUS smatch warnings
@ 2023-06-09 20:00 Anna Schumaker
  2023-06-09 20:00 ` [PATCH v3 2/3] NFSv4.2: Fix READ_PLUS size calculations Anna Schumaker
  2023-06-09 20:00 ` [PATCH v3 3/3] NFSv4.2: Rework scratch handling for READ_PLUS (again) Anna Schumaker
  0 siblings, 2 replies; 6+ messages in thread
From: Anna Schumaker @ 2023-06-09 20:00 UTC (permalink / raw)
  To: linux-nfs, trond.myklebust; +Cc: anna, krzysztof.kozlowski

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 a6df815a140c..ef3b150970ff 100644
--- a/fs/nfs/nfs42xdr.c
+++ b/fs/nfs/nfs42xdr.c
@@ -1136,13 +1136,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


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

end of thread, other threads:[~2023-06-12 20:04 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-09 20:00 [PATCH v3 1/3] NFSv4.2: Fix READ_PLUS smatch warnings Anna Schumaker
2023-06-09 20:00 ` [PATCH v3 2/3] NFSv4.2: Fix READ_PLUS size calculations Anna Schumaker
2023-06-09 20:00 ` [PATCH v3 3/3] NFSv4.2: Rework scratch handling for READ_PLUS (again) Anna Schumaker
2023-06-10 10:13   ` Krzysztof Kozlowski
2023-06-12 19:57     ` Anna Schumaker
2023-06-12 20:04       ` Krzysztof Kozlowski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox