Skip to content

Commit

Permalink
NFSD: prevent underflow in nfssvc_decode_writeargs()
Browse files Browse the repository at this point in the history
commit 184416d upstream.

Smatch complains:

	fs/nfsd/nfsxdr.c:341 nfssvc_decode_writeargs()
	warn: no lower bound on 'args->len'

Change the type to unsigned to prevent this issue.

Cc: stable@vger.kernel.org
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Dan Carpenter authored and gregkh committed Apr 8, 2022
1 parent fced445 commit 413d8fe
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion fs/nfsd/nfsproc.c
Expand Up @@ -230,7 +230,7 @@ nfsd_proc_write(struct svc_rqst *rqstp)
unsigned long cnt = argp->len;
unsigned int nvecs;

dprintk("nfsd: WRITE %s %d bytes at %d\n",
dprintk("nfsd: WRITE %s %u bytes at %d\n",
SVCFH_fmt(&argp->fh),
argp->len, argp->offset);

Expand Down
2 changes: 1 addition & 1 deletion fs/nfsd/xdr.h
Expand Up @@ -32,7 +32,7 @@ struct nfsd_readargs {
struct nfsd_writeargs {
svc_fh fh;
__u32 offset;
int len;
__u32 len;
struct xdr_buf payload;
};

Expand Down

0 comments on commit 413d8fe

Please sign in to comment.