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]
Message-Id: <20140508135404.8e836ca4be368fd60d3b08e7@linux-foundation.org>
Date:	Thu, 8 May 2014 13:54:04 -0700
From:	Andrew Morton <akpm@...ux-foundation.org>
To:	Fabian Frederick <fabf@...net.be>
Cc:	linux-kernel <linux-kernel@...r.kernel.org>,
	Michal Hocko <mhocko@...e.cz>
Subject: Re: [PATCH V2] kernel/res_counter.c: replace simple_strtoull by
 kstrtoull

On Thu, 8 May 2014 19:00:43 +0200 Fabian Frederick <fabf@...net.be> wrote:

> ...
>
> --- a/kernel/res_counter.c
> +++ b/kernel/res_counter.c
> @@ -186,8 +186,8 @@ int res_counter_memparse_write_strategy(const char *buf,
>  
>  	/* return RES_COUNTER_MAX(unlimited) if "-1" is specified */
>  	if (*buf == '-') {
> -		res = simple_strtoull(buf + 1, &end, 10);
> -		if (res != 1 || *end != '\0')
> +		int rc = kstrtoull(buf + 1, 10, &res);
> +		if ((res != 1) || rc)
>  			return -EINVAL;
>  		*resp = RES_COUNTER_MAX;

Two more things!

- there should be a newline after definitions, before code.

- we shouldn't overwrite the kstrtoull() return value.  In this case it
  might have returned -ERANGE but this code will replace that with EINVAL.

--- a/kernel/res_counter.c~kernel-res_counterc-replace-simple_strtoull-by-kstrtoull-fix
+++ a/kernel/res_counter.c
@@ -189,7 +189,10 @@ int res_counter_memparse_write_strategy(
 	/* return RES_COUNTER_MAX(unlimited) if "-1" is specified */
 	if (*buf == '-') {
 		int rc = kstrtoull(buf + 1, 10, &res);
-		if ((res != 1) || rc)
+
+		if (rc)
+			return rc;	
+		if (res != 1)
 			return -EINVAL;
 		*resp = RES_COUNTER_MAX;
 		return 0;
_

--
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