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] [day] [month] [year] [list]
Date:	Thu, 29 May 2014 15:21:53 -0700
From:	Andrew Morton <akpm@...ux-foundation.org>
To:	Fabian Frederick <fabf@...net.be>
Cc:	linux-kernel <linux-kernel@...r.kernel.org>,
	Petr Vandrovec <petr@...drovec.name>
Subject: Re: [PATCH 1/1] fs/ncpfs/getopt.c: replace simple_strtoul by
 kstrtoul

On Fri, 23 May 2014 22:26:11 +0200 Fabian Frederick <fabf@...net.be> wrote:

> Remove obsolete simple_strtoul in ncp_getopt

Looks good to me.

> 
> --- a/fs/ncpfs/getopt.c
> +++ b/fs/ncpfs/getopt.c
> @@ -53,15 +53,14 @@ int ncp_getopt(const char *caller, char **options, const struct ncp_option *opts
>  				return -EINVAL;
>  			}
>  			if (opts->has_arg & OPT_INT) {
> -				char* v;
> +				int rc = kstrtoul(val, 0, value);
>  
> -				*value = simple_strtoul(val, &v, 0);
> -				if (!*v) {
> -					return opts->val;
> +				if (rc) {
> +					pr_info("%s: invalid numeric value in %s=%s\n",
> +						caller, token, val);
> +					return rc;

Because kstrtoul("42foo", ...) returns -EINVAL rather than 42.  This
behaviour isn't obvious - I had to dive into the implementation to work
it out.  We forgot to document what kstrtoul() considers a "parsing
error".


>  				}
> -				pr_info("%s: invalid numeric value in %s=%s\n",
> -					caller, token, val);
> -				return -EDOM;
> +				return opts->val;
>  			}
>  			if (opts->has_arg & OPT_STRING) {
>  				return opts->val;
> -- 
> 1.9.1
--
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