2007-08-29 19:28:34

by James Lentini

[permalink] [raw]
Subject: [PATCH] NFS: fix length computation in nfs_validate_mount_data


While experimenting with the new string mount infrastructure, I
noticed an off by one error in the computation of the hostname's
length. This patch fixes the length computation to match the same
computation in nfs4_validate_mount_data().

Signed-off-by: James Lentini <[email protected]>
---

fs/nfs/super.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

--- fs/nfs/super.c 2007-08-29 15:06:59.320932000 -0400
+++ fs/nfs/super.c 2007-08-29 15:07:51.439960000 -0400
@@ -1153,7 +1153,7 @@ static int nfs_validate_mount_data(struc
c = strchr(dev_name, ':');
if (c == NULL)
return -EINVAL;
- len = c - dev_name - 1;
+ len = c - dev_name;
if (len > sizeof(data->hostname))
return -EINVAL;
strncpy(data->hostname, dev_name, len);

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs


2007-08-29 20:41:31

by Trond Myklebust

[permalink] [raw]
Subject: Re: [PATCH] NFS: fix length computation in nfs_validate_mount_data

On Wed, 2007-08-29 at 16:30 -0400, Chuck Lever wrote:
> Yep, this is the same fix as one provided in the clean-up/bug-fix
> patches I just resent today.

Sure, but we shouldn't be sending pure cleanups to Linus when we're
already in an -rc4 release. OTOH, I'd like to fix genuine bugs like
this, so I'll probably send in James' patch for now, and then let the
cleanups lie until the 2.6.24 merge window opens.

Cheers
Trond


> James Lentini wrote:
> > While experimenting with the new string mount infrastructure, I
> > noticed an off by one error in the computation of the hostname's
> > length. This patch fixes the length computation to match the same
> > computation in nfs4_validate_mount_data().
> >
> > Signed-off-by: James Lentini <[email protected]>
> > ---
> >
> > fs/nfs/super.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > --- fs/nfs/super.c 2007-08-29 15:06:59.320932000 -0400
> > +++ fs/nfs/super.c 2007-08-29 15:07:51.439960000 -0400
> > @@ -1153,7 +1153,7 @@ static int nfs_validate_mount_data(struc
> > c = strchr(dev_name, ':');
> > if (c == NULL)
> > return -EINVAL;
> > - len = c - dev_name - 1;
> > + len = c - dev_name;
> > if (len > sizeof(data->hostname))
> > return -EINVAL;
> > strncpy(data->hostname, dev_name, len);
>


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs

2007-08-29 20:56:49

by James Lentini

[permalink] [raw]
Subject: Re: [PATCH] NFS: fix length computation in nfs_validate_mount_data


Agreed. I didn't notice this in your patches.

On Wed, 29 Aug 2007, Chuck Lever wrote:

> Yep, this is the same fix as one provided in the clean-up/bug-fix patches I
> just resent today.
>
>
> James Lentini wrote:
> > While experimenting with the new string mount infrastructure, I noticed an
> > off by one error in the computation of the hostname's length. This patch
> > fixes the length computation to match the same computation in
> > nfs4_validate_mount_data().
> >
> > Signed-off-by: James Lentini <[email protected]>
> > ---
> >
> > fs/nfs/super.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > --- fs/nfs/super.c 2007-08-29 15:06:59.320932000 -0400
> > +++ fs/nfs/super.c 2007-08-29 15:07:51.439960000 -0400
> > @@ -1153,7 +1153,7 @@ static int nfs_validate_mount_data(struc
> > c = strchr(dev_name, ':');
> > if (c == NULL)
> > return -EINVAL;
> > - len = c - dev_name - 1;
> > + len = c - dev_name;
> > if (len > sizeof(data->hostname))
> > return -EINVAL;
> > strncpy(data->hostname, dev_name, len);
>
>

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs

2007-08-29 21:10:38

by Trond Myklebust

[permalink] [raw]
Subject: Re: [PATCH] NFS: fix length computation in nfs_validate_mount_data

On Wed, 2007-08-29 at 17:06 -0400, Chuck Lever wrote:

> These are not just clean-ups. They really are bug-fixes for the API.
> I'm sorry I didn't recognize the semantic distinction in the patch
> description.
>
> As Tom said, these really are needed to make the interface useful.

Could you in that case, please correct the changelog entries (pointing
out exactly which bugs/interface flaws are being fixed), and resend.

Cheers
Trond


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs