* [PATCH linux-next] NFSD: remove redundant variable status
@ 2022-08-31 14:20 cgel.zte
2022-08-31 14:34 ` Chuck Lever III
0 siblings, 1 reply; 2+ messages in thread
From: cgel.zte @ 2022-08-31 14:20 UTC (permalink / raw)
To: chuck.lever, jlayton; +Cc: linux-nfs, linux-kernel, Jinpeng Cui, Zeal Robot
From: Jinpeng Cui <cui.jinpeng2@zte.com.cn>
Return value directly from fh_verify() do_open_permission()
exp_pseudoroot() instead of getting value from
redundant variable status.
Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Jinpeng Cui <cui.jinpeng2@zte.com.cn>
---
fs/nfsd/nfs4proc.c | 16 ++++------------
1 file changed, 4 insertions(+), 12 deletions(-)
diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
index 757d8959f992..7055e1c91d0e 100644
--- a/fs/nfsd/nfs4proc.c
+++ b/fs/nfsd/nfs4proc.c
@@ -141,7 +141,6 @@ fh_dup2(struct svc_fh *dst, struct svc_fh *src)
static __be32
do_open_permission(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_open *open, int accmode)
{
- __be32 status;
if (open->op_truncate &&
!(open->op_share_access & NFS4_SHARE_ACCESS_WRITE))
@@ -156,9 +155,7 @@ do_open_permission(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfs
if (open->op_share_deny & NFS4_SHARE_DENY_READ)
accmode |= NFSD_MAY_WRITE;
- status = fh_verify(rqstp, current_fh, S_IFREG, accmode);
-
- return status;
+ return fh_verify(rqstp, current_fh, S_IFREG, accmode);
}
static __be32 nfsd_check_obj_isreg(struct svc_fh *fh)
@@ -454,7 +451,6 @@ static __be32
do_open_fhandle(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, struct nfsd4_open *open)
{
struct svc_fh *current_fh = &cstate->current_fh;
- __be32 status;
int accmode = 0;
/* We don't know the target directory, and therefore can not
@@ -479,9 +475,7 @@ do_open_fhandle(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, str
if (open->op_claim_type == NFS4_OPEN_CLAIM_DELEG_CUR_FH)
accmode = NFSD_MAY_OWNER_OVERRIDE;
- status = do_open_permission(rqstp, current_fh, open, accmode);
-
- return status;
+ return do_open_permission(rqstp, current_fh, open, accmode);
}
static void
@@ -668,11 +662,9 @@ static __be32
nfsd4_putrootfh(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
union nfsd4_op_u *u)
{
- __be32 status;
-
fh_put(&cstate->current_fh);
- status = exp_pseudoroot(rqstp, &cstate->current_fh);
- return status;
+
+ return exp_pseudoroot(rqstp, &cstate->current_fh);
}
static __be32
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH linux-next] NFSD: remove redundant variable status
2022-08-31 14:20 [PATCH linux-next] NFSD: remove redundant variable status cgel.zte
@ 2022-08-31 14:34 ` Chuck Lever III
0 siblings, 0 replies; 2+ messages in thread
From: Chuck Lever III @ 2022-08-31 14:34 UTC (permalink / raw)
To: cgel.zte
Cc: Jeff Layton, Linux NFS Mailing List, Linux Kernel Mailing List,
Jinpeng Cui, Zeal Robot
> On Aug 31, 2022, at 10:20 AM, cgel.zte@gmail.com wrote:
>
> From: Jinpeng Cui <cui.jinpeng2@zte.com.cn>
>
> Return value directly from fh_verify() do_open_permission()
> exp_pseudoroot() instead of getting value from
> redundant variable status.
>
> Reported-by: Zeal Robot <zealci@zte.com.cn>
> Signed-off-by: Jinpeng Cui <cui.jinpeng2@zte.com.cn>
Applied for v6.1. Thanks!
> ---
> fs/nfsd/nfs4proc.c | 16 ++++------------
> 1 file changed, 4 insertions(+), 12 deletions(-)
>
> diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
> index 757d8959f992..7055e1c91d0e 100644
> --- a/fs/nfsd/nfs4proc.c
> +++ b/fs/nfsd/nfs4proc.c
> @@ -141,7 +141,6 @@ fh_dup2(struct svc_fh *dst, struct svc_fh *src)
> static __be32
> do_open_permission(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_open *open, int accmode)
> {
> - __be32 status;
>
> if (open->op_truncate &&
> !(open->op_share_access & NFS4_SHARE_ACCESS_WRITE))
> @@ -156,9 +155,7 @@ do_open_permission(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfs
> if (open->op_share_deny & NFS4_SHARE_DENY_READ)
> accmode |= NFSD_MAY_WRITE;
>
> - status = fh_verify(rqstp, current_fh, S_IFREG, accmode);
> -
> - return status;
> + return fh_verify(rqstp, current_fh, S_IFREG, accmode);
> }
>
> static __be32 nfsd_check_obj_isreg(struct svc_fh *fh)
> @@ -454,7 +451,6 @@ static __be32
> do_open_fhandle(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, struct nfsd4_open *open)
> {
> struct svc_fh *current_fh = &cstate->current_fh;
> - __be32 status;
> int accmode = 0;
>
> /* We don't know the target directory, and therefore can not
> @@ -479,9 +475,7 @@ do_open_fhandle(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, str
> if (open->op_claim_type == NFS4_OPEN_CLAIM_DELEG_CUR_FH)
> accmode = NFSD_MAY_OWNER_OVERRIDE;
>
> - status = do_open_permission(rqstp, current_fh, open, accmode);
> -
> - return status;
> + return do_open_permission(rqstp, current_fh, open, accmode);
> }
>
> static void
> @@ -668,11 +662,9 @@ static __be32
> nfsd4_putrootfh(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
> union nfsd4_op_u *u)
> {
> - __be32 status;
> -
> fh_put(&cstate->current_fh);
> - status = exp_pseudoroot(rqstp, &cstate->current_fh);
> - return status;
> +
> + return exp_pseudoroot(rqstp, &cstate->current_fh);
> }
>
> static __be32
> --
> 2.25.1
>
--
Chuck Lever
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-08-31 14:35 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-31 14:20 [PATCH linux-next] NFSD: remove redundant variable status cgel.zte
2022-08-31 14:34 ` Chuck Lever III
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.