diff mbox

[1/9] nfs: the length argument to read_buf should be unsigned

Message ID 1473174760-29859-2-git-send-email-jlayton@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jeff Layton Sept. 6, 2016, 3:12 p.m. UTC
Signed-off-by: Jeff Layton <jlayton@redhat.com>
---
 fs/nfs/callback_xdr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Schumaker, Anna Sept. 8, 2016, 5:39 p.m. UTC | #1
Hi Jeff,

On 09/06/2016 11:12 AM, Jeff Layton wrote:
> Signed-off-by: Jeff Layton <jlayton@redhat.com>
> ---
>  fs/nfs/callback_xdr.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/nfs/callback_xdr.c b/fs/nfs/callback_xdr.c
> index 656f68f7fe53..d6a40c06ec26 100644
> --- a/fs/nfs/callback_xdr.c
> +++ b/fs/nfs/callback_xdr.c
> @@ -72,7 +72,7 @@ static int nfs4_encode_void(struct svc_rqst *rqstp, __be32 *p, void *dummy)
>  	return xdr_ressize_check(rqstp, p);
>  }
>  
> -static __be32 *read_buf(struct xdr_stream *xdr, int nbytes)
> +static __be32 *read_buf(struct xdr_stream *xdr, unsigned int nbytes)

Looks like the nbytes argument is only used by xdr_inline_decode(), which expects a size_t instead of an unsigned int.  If we're changing argument types, then maybe we should change it to a size_t instead.

Thoughts?
Anna

>  {
>  	__be32 *p;
>  
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Jeff Layton Sept. 8, 2016, 6:19 p.m. UTC | #2
On Thu, 2016-09-08 at 13:39 -0400, Anna Schumaker wrote:
> Hi Jeff,
> 
> On 09/06/2016 11:12 AM, Jeff Layton wrote:
> > 
> > Signed-off-by: Jeff Layton <jlayton@redhat.com>
> > ---
> >  fs/nfs/callback_xdr.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/fs/nfs/callback_xdr.c b/fs/nfs/callback_xdr.c
> > index 656f68f7fe53..d6a40c06ec26 100644
> > --- a/fs/nfs/callback_xdr.c
> > +++ b/fs/nfs/callback_xdr.c
> > @@ -72,7 +72,7 @@ static int nfs4_encode_void(struct svc_rqst
> > *rqstp, __be32 *p, void *dummy)
> >  	return xdr_ressize_check(rqstp, p);
> >  }
> >  
> > -static __be32 *read_buf(struct xdr_stream *xdr, int nbytes)
> > +static __be32 *read_buf(struct xdr_stream *xdr, unsigned int
> > nbytes)
> 
> Looks like the nbytes argument is only used by xdr_inline_decode(),
> which expects a size_t instead of an unsigned int.  If we're changing
> argument types, then maybe we should change it to a size_t instead.
> 
> Thoughts?
> Anna


Sure, that works too. I'd have a hard time imagining when we'd ever use
those upper bits when size_t is 64 bits, but I doubt it'd hurt
anything. I'll go ahead and change that in my tree.
diff mbox

Patch

diff --git a/fs/nfs/callback_xdr.c b/fs/nfs/callback_xdr.c
index 656f68f7fe53..d6a40c06ec26 100644
--- a/fs/nfs/callback_xdr.c
+++ b/fs/nfs/callback_xdr.c
@@ -72,7 +72,7 @@  static int nfs4_encode_void(struct svc_rqst *rqstp, __be32 *p, void *dummy)
 	return xdr_ressize_check(rqstp, p);
 }
 
-static __be32 *read_buf(struct xdr_stream *xdr, int nbytes)
+static __be32 *read_buf(struct xdr_stream *xdr, unsigned int nbytes)
 {
 	__be32 *p;