diff mbox

nfsd: Fix bad reserving space for encoding rdattr_error

Message ID 53B8C3D3.7080201@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Kinglong Mee July 6, 2014, 3:34 a.m. UTC
Introduced by commit 561f0ed498 (nfsd4: allow large readdirs).

Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
---
 fs/nfsd/nfs4xdr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

J. Bruce Fields July 7, 2014, 6:15 p.m. UTC | #1
On Sun, Jul 06, 2014 at 11:34:43AM +0800, Kinglong Mee wrote:
> Introduced by commit 561f0ed498 (nfsd4: allow large readdirs).

Whoops, thanks.  Queueing up for 3.16.--b.

> 
> Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
> ---
>  fs/nfsd/nfs4xdr.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
> index 3540462..5a1d088 100644
> --- a/fs/nfsd/nfs4xdr.c
> +++ b/fs/nfsd/nfs4xdr.c
> @@ -2646,7 +2646,7 @@ nfsd4_encode_rdattr_error(struct xdr_stream *xdr, __be32 nfserr)
>  {
>  	__be32 *p;
>  
> -	p = xdr_reserve_space(xdr, 6);
> +	p = xdr_reserve_space(xdr, 20);
>  	if (!p)
>  		return NULL;
>  	*p++ = htonl(2);
> -- 
> 1.9.3
> 
--
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
Christoph Hellwig July 10, 2014, 10:54 a.m. UTC | #2
On Mon, Jul 07, 2014 at 02:15:56PM -0400, J. Bruce Fields wrote:
> > -	p = xdr_reserve_space(xdr, 6);
> > +	p = xdr_reserve_space(xdr, 20);

Can we please convert all these magic numbers to expressions adding up
sizeofs or where that doesn't fit use #defines?

--
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
J. Bruce Fields July 11, 2014, 8:11 p.m. UTC | #3
On Thu, Jul 10, 2014 at 03:54:51AM -0700, Christoph Hellwig wrote:
> On Mon, Jul 07, 2014 at 02:15:56PM -0400, J. Bruce Fields wrote:
> > > -	p = xdr_reserve_space(xdr, 6);
> > > +	p = xdr_reserve_space(xdr, 20);
> 
> Can we please convert all these magic numbers to expressions adding up
> sizeofs or where that doesn't fit use #defines?

So, this would be 

	xdr_reserve_space(xdr, 5 * sizeof(be32));

?  I guess that'd be OK.

--b.
--
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
Christoph Hellwig July 14, 2014, 9:59 a.m. UTC | #4
On Fri, Jul 11, 2014 at 04:11:29PM -0400, J. Bruce Fields wrote:
> > On Mon, Jul 07, 2014 at 02:15:56PM -0400, J. Bruce Fields wrote:
> > > > -	p = xdr_reserve_space(xdr, 6);
> > > > +	p = xdr_reserve_space(xdr, 20);
> > 
> > Can we please convert all these magic numbers to expressions adding up
> > sizeofs or where that doesn't fit use #defines?
> 
> So, this would be 
> 
> 	xdr_reserve_space(xdr, 5 * sizeof(be32));
> 
> ?  I guess that'd be OK.

Yes, that makes a lot more sense.  I'm still hoping to make progress
on my krpcgen one day..
--
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
J. Bruce Fields July 16, 2014, 10:06 p.m. UTC | #5
On Mon, Jul 14, 2014 at 02:59:44AM -0700, Christoph Hellwig wrote:
> On Fri, Jul 11, 2014 at 04:11:29PM -0400, J. Bruce Fields wrote:
> > > On Mon, Jul 07, 2014 at 02:15:56PM -0400, J. Bruce Fields wrote:
> > > > > -	p = xdr_reserve_space(xdr, 6);
> > > > > +	p = xdr_reserve_space(xdr, 20);
> > > 
> > > Can we please convert all these magic numbers to expressions adding up
> > > sizeofs or where that doesn't fit use #defines?
> > 
> > So, this would be 
> > 
> > 	xdr_reserve_space(xdr, 5 * sizeof(be32));
> > 
> > ?  I guess that'd be OK.
> 
> Yes, that makes a lot more sense.

Sounds reasonable to me.  I'm not volunteering for now.

> I'm still hoping to make progress
> on my krpcgen one day..

OK, good luck....

--b.
--
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
Kinglong Mee July 17, 2014, 1:18 p.m. UTC | #6
On 7/17/2014 06:06, J. Bruce Fields wrote:
> On Mon, Jul 14, 2014 at 02:59:44AM -0700, Christoph Hellwig wrote:
>> On Fri, Jul 11, 2014 at 04:11:29PM -0400, J. Bruce Fields wrote:
>>>> On Mon, Jul 07, 2014 at 02:15:56PM -0400, J. Bruce Fields wrote:
>>>>>> -	p = xdr_reserve_space(xdr, 6);
>>>>>> +	p = xdr_reserve_space(xdr, 20);
>>>>
>>>> Can we please convert all these magic numbers to expressions adding up
>>>> sizeofs or where that doesn't fit use #defines?
>>>
>>> So, this would be 
>>>
>>> 	xdr_reserve_space(xdr, 5 * sizeof(be32));
>>>
>>> ?  I guess that'd be OK.
>>
>> Yes, that makes a lot more sense.
> 
> Sounds reasonable to me.  I'm not volunteering for now.

I will try to converting those codes today.

thanks,
Kinglong Mee

> 
>> I'm still hoping to make progress
>> on my krpcgen one day..
> 
> OK, good luck....
> 
> --b.
> .
> 
--
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
diff mbox

Patch

diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
index 3540462..5a1d088 100644
--- a/fs/nfsd/nfs4xdr.c
+++ b/fs/nfsd/nfs4xdr.c
@@ -2646,7 +2646,7 @@  nfsd4_encode_rdattr_error(struct xdr_stream *xdr, __be32 nfserr)
 {
 	__be32 *p;
 
-	p = xdr_reserve_space(xdr, 6);
+	p = xdr_reserve_space(xdr, 20);
 	if (!p)
 		return NULL;
 	*p++ = htonl(2);