lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 10 Jul 2012 12:31:20 -0400
From:	"J. Bruce Fields" <bfields@...ldses.org>
To:	Eldad Zack <eldad@...refinery.com>
Cc:	Trond Myklebust <Trond.Myklebust@...app.com>,
	Joe Perches <joe@...ches.com>, linux-nfs@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/2,resend] sunrpc/cache.h: replace simple_strtoul

Thanks, applying.

On Fri, Jul 06, 2012 at 09:31:57PM +0200, Eldad Zack wrote:
> This patch replaces the usage of simple_strtoul with kstrtoint in
> get_int(), since the simple_str* family doesn't account for overflow
> and is deprecated.
> Also, in this specific case, the long from strtol is silently converted
> to an int by the caller.

(By the way, one advantage which simple_str* does have is documentation.
Some kerneldoc comments might be helpful for kstrto* as well?)

--b.

> 
> As Joe Perches <joe@...ches.com> suggested, this patch also removes
> the redundant temporary variable rv, since kstrtoint() will not write to
> anint unless it's successful.
> 
> Cc: Joe Perches <joe@...ches.com>
> Signed-off-by: Eldad Zack <eldad@...refinery.com>
> ---
> Resent to include improvements from Joe Perches and proper changelog as
> J. Bruce Fields kindly pointed out.
>  include/linux/sunrpc/cache.h |    6 +-----
>  1 file changed, 1 insertion(+), 5 deletions(-)
> 
> diff --git a/include/linux/sunrpc/cache.h b/include/linux/sunrpc/cache.h
> index 6def1f6..af42596 100644
> --- a/include/linux/sunrpc/cache.h
> +++ b/include/linux/sunrpc/cache.h
> @@ -217,8 +217,6 @@ extern int qword_get(char **bpp, char *dest, int bufsize);
>  static inline int get_int(char **bpp, int *anint)
>  {
>  	char buf[50];
> -	char *ep;
> -	int rv;
>  	int len = qword_get(bpp, buf, sizeof(buf));
>  
>  	if (len < 0)
> @@ -226,11 +224,9 @@ static inline int get_int(char **bpp, int *anint)
>  	if (len == 0)
>  		return -ENOENT;
>  
> -	rv = simple_strtol(buf, &ep, 0);
> -	if (*ep)
> +	if (kstrtoint(buf, 0, anint))
>  		return -EINVAL;
>  
> -	*anint = rv;
>  	return 0;
>  }
>  
> -- 
> 1.7.10
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ