Skip to contentSkip to conversation

sunrpc: removed redundant procp check

PATCH Applied Aleksandr Aprelkov 3 participants 3 messages Mar 27, 2024

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sunrpc: removed redundant procp check

since vs_proc pointer is dereferenced before getting it's address there's no need to check for NULL.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes 8e5b67731d08 ("SUNRPC: Add a callback to initialise server requests")
---
 net/sunrpc/svc.c | 2 --
 1 file changed, 2 deletions(-)
net/sunrpc/svc.c +0 -2
index b33e429336fb..2b4b1276d4e8 100644
@@ -1265,8 +1265,6 @@ svc_generic_init_request(struct svc_rqst *rqstp,
 	if (rqstp->rq_proc >= versp->vs_nproc)
 		goto err_bad_proc;
 	rqstp->rq_procinfo = procp = &versp->vs_proc[rqstp->rq_proc];
-	if (!procp)
-		goto err_bad_proc;
 
 	/* Initialize storage for argp and resp */
 	memset(rqstp->rq_argp, 0, procp->pc_argzero);
Signature · 1 line
2.34.1
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 16 lines · Aleksandr Aprelkov

since vs_proc pointer is dereferenced before getting it's address there's no need to check for NULL.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes 8e5b67731d08 ("SUNRPC: Add a callback to initialise server requests")
---
 net/sunrpc/svc.c | 2 --
 1 file changed, 2 deletions(-)
net/sunrpc/svc.c +0 -0
index b33e429336fb..2b4b1276d4e8 100644

net/sunrpc/svc.c svc_generic_init_request(struct svc_rqst *rqstp, · line 1270

Quoted 8 lines
net/sunrpc/svc.c +0 -2
@@ -1265,8 +1265,6 @@ svc_generic_init_request(struct svc_rqst *rqstp,
 	if (rqstp->rq_proc >= versp->vs_nproc)
 		goto err_bad_proc;
 	rqstp->rq_procinfo = procp = &versp->vs_proc[rqstp->rq_proc];
-	if (!procp)
-		goto err_bad_proc;
 
 	/* Initialize storage for argp and resp */
 	memset(rqstp->rq_argp, 0, procp->pc_argzero);

This should probably go in via Chuck's tree.

Applied
#2 lore raw
In reply to Aleksandr Aprelkov
Quoted 7 lines · Aleksandr Aprelkov

since vs_proc pointer is dereferenced before getting it's address there's no need to check for NULL.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes 8e5b67731d08 ("SUNRPC: Add a callback to initialise server requests")

Applied to nfsd-next. Thanks!

Quoted 20 lines
---
 net/sunrpc/svc.c | 2 --
 1 file changed, 2 deletions(-)
net/sunrpc/svc.c +0 -2
index b33e429336fb..2b4b1276d4e8 100644
@@ -1265,8 +1265,6 @@ svc_generic_init_request(struct svc_rqst *rqstp,
 	if (rqstp->rq_proc >= versp->vs_nproc)
 		goto err_bad_proc;
 	rqstp->rq_procinfo = procp = &versp->vs_proc[rqstp->rq_proc];
-	if (!procp)
-		goto err_bad_proc;
 
 	/* Initialize storage for argp and resp */
 	memset(rqstp->rq_argp, 0, procp->pc_argzero);
Signature · 1 line
2.34.1
Signature · 1 line
Chuck Lever