Commit 2425359b authored by Neil Brown's avatar Neil Brown Committed by Linus Torvalds

[PATCH] knfsd: fix some signed ints that should be unsigned

Signed-off-by: default avatarNeil Brown <neilb@cse.unsw.edu.au>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 7551961b
...@@ -74,7 +74,7 @@ decode_fh(u32 *p, struct svc_fh *fhp) ...@@ -74,7 +74,7 @@ decode_fh(u32 *p, struct svc_fh *fhp)
static inline u32 * static inline u32 *
encode_fh(u32 *p, struct svc_fh *fhp) encode_fh(u32 *p, struct svc_fh *fhp)
{ {
int size = fhp->fh_handle.fh_size; unsigned int size = fhp->fh_handle.fh_size;
*p++ = htonl(size); *p++ = htonl(size);
if (size) p[XDR_QUADLEN(size)-1]=0; if (size) p[XDR_QUADLEN(size)-1]=0;
memcpy(p, &fhp->fh_handle.fh_base, size); memcpy(p, &fhp->fh_handle.fh_base, size);
...@@ -328,7 +328,7 @@ int ...@@ -328,7 +328,7 @@ int
nfs3svc_decode_readargs(struct svc_rqst *rqstp, u32 *p, nfs3svc_decode_readargs(struct svc_rqst *rqstp, u32 *p,
struct nfsd3_readargs *args) struct nfsd3_readargs *args)
{ {
int len; unsigned int len;
int v,pn; int v,pn;
if (!(p = decode_fh(p, &args->fh)) if (!(p = decode_fh(p, &args->fh))
...@@ -358,7 +358,7 @@ int ...@@ -358,7 +358,7 @@ int
nfs3svc_decode_writeargs(struct svc_rqst *rqstp, u32 *p, nfs3svc_decode_writeargs(struct svc_rqst *rqstp, u32 *p,
struct nfsd3_writeargs *args) struct nfsd3_writeargs *args)
{ {
int len, v; unsigned int len, v, hdr;
if (!(p = decode_fh(p, &args->fh)) if (!(p = decode_fh(p, &args->fh))
|| !(p = xdr_decode_hyper(p, &args->offset))) || !(p = xdr_decode_hyper(p, &args->offset)))
...@@ -368,9 +368,12 @@ nfs3svc_decode_writeargs(struct svc_rqst *rqstp, u32 *p, ...@@ -368,9 +368,12 @@ nfs3svc_decode_writeargs(struct svc_rqst *rqstp, u32 *p,
args->stable = ntohl(*p++); args->stable = ntohl(*p++);
len = args->len = ntohl(*p++); len = args->len = ntohl(*p++);
hdr = (void*)p - rqstp->rq_arg.head[0].iov_base;
if (rqstp->rq_arg.len < len + hdr)
return 0;
args->vec[0].iov_base = (void*)p; args->vec[0].iov_base = (void*)p;
args->vec[0].iov_len = rqstp->rq_arg.head[0].iov_len - args->vec[0].iov_len = rqstp->rq_arg.head[0].iov_len - hdr;
(((void*)p) - rqstp->rq_arg.head[0].iov_base);
if (len > NFSSVC_MAXBLKSIZE) if (len > NFSSVC_MAXBLKSIZE)
len = NFSSVC_MAXBLKSIZE; len = NFSSVC_MAXBLKSIZE;
...@@ -427,7 +430,7 @@ int ...@@ -427,7 +430,7 @@ int
nfs3svc_decode_symlinkargs(struct svc_rqst *rqstp, u32 *p, nfs3svc_decode_symlinkargs(struct svc_rqst *rqstp, u32 *p,
struct nfsd3_symlinkargs *args) struct nfsd3_symlinkargs *args)
{ {
int len; unsigned int len;
int avail; int avail;
char *old, *new; char *old, *new;
struct kvec *vec; struct kvec *vec;
...@@ -444,7 +447,7 @@ nfs3svc_decode_symlinkargs(struct svc_rqst *rqstp, u32 *p, ...@@ -444,7 +447,7 @@ nfs3svc_decode_symlinkargs(struct svc_rqst *rqstp, u32 *p,
*/ */
svc_take_page(rqstp); svc_take_page(rqstp);
len = ntohl(*p++); len = ntohl(*p++);
if (len <= 0 || len > NFS3_MAXPATHLEN || len >= PAGE_SIZE) if (len == 0 || len > NFS3_MAXPATHLEN || len >= PAGE_SIZE)
return 0; return 0;
args->tname = new = page_address(rqstp->rq_respages[rqstp->rq_resused-1]); args->tname = new = page_address(rqstp->rq_respages[rqstp->rq_resused-1]);
args->tlen = len; args->tlen = len;
......
...@@ -234,7 +234,7 @@ int ...@@ -234,7 +234,7 @@ int
nfssvc_decode_readargs(struct svc_rqst *rqstp, u32 *p, nfssvc_decode_readargs(struct svc_rqst *rqstp, u32 *p,
struct nfsd_readargs *args) struct nfsd_readargs *args)
{ {
int len; unsigned int len;
int v,pn; int v,pn;
if (!(p = decode_fh(p, &args->fh))) if (!(p = decode_fh(p, &args->fh)))
return 0; return 0;
...@@ -266,7 +266,7 @@ int ...@@ -266,7 +266,7 @@ int
nfssvc_decode_writeargs(struct svc_rqst *rqstp, u32 *p, nfssvc_decode_writeargs(struct svc_rqst *rqstp, u32 *p,
struct nfsd_writeargs *args) struct nfsd_writeargs *args)
{ {
int len; unsigned int len;
int v; int v;
if (!(p = decode_fh(p, &args->fh))) if (!(p = decode_fh(p, &args->fh)))
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment