diff mbox series

sunrpc: removed redundant procp check

Message ID 20240327071044.365284-1-aaprelkov@usergate.com (mailing list archive)
State Not Applicable
Delegated to: Netdev Maintainers
Headers show
Series sunrpc: removed redundant procp check | expand

Checks

Context Check Description
netdev/series_format warning Single patches do not need cover letters; Target tree name not specified in the subject
netdev/tree_selection success Guessed tree name to be net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 944 this patch: 944
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers fail 1 blamed authors not CCed: bfields@fieldses.org; 1 maintainers not CCed: bfields@fieldses.org
netdev/build_clang success Errors and warnings before: 955 this patch: 955
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 955 this patch: 955
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 8 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2024-03-27--15-00 (tests: 952)

Commit Message

Aleksandr Aprelkov March 27, 2024, 7:10 a.m. UTC
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")
Signed-off-by: Aleksandr Aprelkov <aaprelkov@usergate.com>
---
 net/sunrpc/svc.c | 2 --
 1 file changed, 2 deletions(-)

Comments

Jeff Layton March 27, 2024, 10:09 a.m. UTC | #1
On Wed, 2024-03-27 at 14:10 +0700, Aleksandr Aprelkov wrote:
> 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")
> Signed-off-by: Aleksandr Aprelkov <aaprelkov@usergate.com>
> ---
>  net/sunrpc/svc.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c
> index b33e429336fb..2b4b1276d4e8 100644
> --- a/net/sunrpc/svc.c
> +++ b/net/sunrpc/svc.c
> @@ -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.

Reviewed-by: Jeff Layton <jlayton@kernel.org>
Chuck Lever III March 27, 2024, 2:10 p.m. UTC | #2
On Wed, Mar 27, 2024 at 02:10:44PM +0700, Aleksandr Aprelkov wrote:
> 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")
> Signed-off-by: Aleksandr Aprelkov <aaprelkov@usergate.com>

Applied to nfsd-next. Thanks!


> ---
>  net/sunrpc/svc.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c
> index b33e429336fb..2b4b1276d4e8 100644
> --- a/net/sunrpc/svc.c
> +++ b/net/sunrpc/svc.c
> @@ -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);
> -- 
> 2.34.1
>
diff mbox series

Patch

diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c
index b33e429336fb..2b4b1276d4e8 100644
--- a/net/sunrpc/svc.c
+++ b/net/sunrpc/svc.c
@@ -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);