From: Dan Carpenter Date: Tue, 15 Mar 2022 10:30:09 +0000 (+0300) Subject: NFSD: prevent underflow in nfssvc_decode_writeargs() X-Git-Tag: v4.14.276~262 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=438068f4912183a59fcb6b7496a06437f7fd4e2b;p=thirdparty%2Fkernel%2Fstable.git NFSD: prevent underflow in nfssvc_decode_writeargs() commit 184416d4b98509fb4c3d8fc3d6dc1437896cc159 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 Signed-off-by: Chuck Lever Signed-off-by: Greg Kroah-Hartman --- diff --git a/fs/nfsd/nfsproc.c b/fs/nfsd/nfsproc.c index fc6282181a1fa..65d1aae9bfdee 100644 --- a/fs/nfsd/nfsproc.c +++ b/fs/nfsd/nfsproc.c @@ -227,7 +227,7 @@ nfsd_proc_write(struct svc_rqst *rqstp) __be32 nfserr; unsigned long cnt = argp->len; - 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); diff --git a/fs/nfsd/xdr.h b/fs/nfsd/xdr.h index 2f4f22e6b8cbe..046454a621564 100644 --- a/fs/nfsd/xdr.h +++ b/fs/nfsd/xdr.h @@ -33,7 +33,7 @@ struct nfsd_readargs { struct nfsd_writeargs { svc_fh fh; __u32 offset; - int len; + __u32 len; int vlen; };