diff mbox

[06/14] nfsd: allow configuring nfsd to listen on 5-digit ports

Message ID 1345582652-18476-7-git-send-email-bfields@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Bruce Fields Aug. 21, 2012, 8:57 p.m. UTC
From: "J. Bruce Fields" <bfields@redhat.com>

Note a 16-bit value can require up to 5 digits.

Signed-off-by: J. Bruce Fields <bfields@redhat.com>
---
 fs/nfsd/nfsctl.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Bruce Fields Aug. 21, 2012, 9:25 p.m. UTC | #1
Second time we've seen a mistake like that recently, so maybe we really
should add the string-length-of-a-number macro.

--b.

On Tue, Aug 21, 2012 at 04:57:24PM -0400, J. Bruce Fields wrote:
> From: "J. Bruce Fields" <bfields@redhat.com>
> 
> Note a 16-bit value can require up to 5 digits.
> 
> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
> ---
>  fs/nfsd/nfsctl.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c
> index 89be13c..e41a08ff 100644
> --- a/fs/nfsd/nfsctl.c
> +++ b/fs/nfsd/nfsctl.c
> @@ -712,7 +712,7 @@ static ssize_t __write_ports_addxprt(char *buf)
>  	int port, err;
>  	struct net *net = &init_net;
>  
> -	if (sscanf(buf, "%15s %4u", transport, &port) != 2)
> +	if (sscanf(buf, "%15s %5u", transport, &port) != 2)
>  		return -EINVAL;
>  
>  	if (port < 1 || port > USHRT_MAX)
> -- 
> 1.7.9.5
> 
--
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/nfsctl.c b/fs/nfsd/nfsctl.c
index 89be13c..e41a08ff 100644
--- a/fs/nfsd/nfsctl.c
+++ b/fs/nfsd/nfsctl.c
@@ -712,7 +712,7 @@  static ssize_t __write_ports_addxprt(char *buf)
 	int port, err;
 	struct net *net = &init_net;
 
-	if (sscanf(buf, "%15s %4u", transport, &port) != 2)
+	if (sscanf(buf, "%15s %5u", transport, &port) != 2)
 		return -EINVAL;
 
 	if (port < 1 || port > USHRT_MAX)