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]
Message-Id: <20110106154757.75fb6b2a.akpm@linux-foundation.org>
Date:	Thu, 6 Jan 2011 15:47:57 -0800
From:	Andrew Morton <akpm@...ux-foundation.org>
To:	Hillf Danton <dhillf@...il.com>
Cc:	linux-kernel@...r.kernel.org, Rik van Riel <riel@...hat.com>,
	Peter Zijlstra <a.p.zijlstra@...llo.nl>,
	Mike Galbraith <efault@....de>
Subject: Re: [PATCH] sched: fix strncmp operation

On Thu, 6 Jan 2011 20:58:12 +0800
Hillf Danton <dhillf@...il.com> wrote:

> One of the operands, buf, is incorrect, since it is stripped and the
> correct address for subsequent string comparing could change if
> leading white spaces, if any, are removed from buf.
> 
> It is fixed by replacing buf with cmp.
> 
> Signed-off-by: Hillf Danton <dhillf@...il.com>
> ---
> 
> --- a/kernel/sched.c	2010-11-01 19:54:12.000000000 +0800
> +++ b/kernel/sched.c	2011-01-06 20:52:02.000000000 +0800
> @@ -751,7 +751,7 @@ sched_feat_write(struct file *filp, cons
>  	buf[cnt] = 0;
>  	cmp = strstrip(buf);
> 
> -	if (strncmp(buf, "NO_", 3) == 0) {
> +	if (strncmp(cmp, "NO_", 3) == 0) {
>  		neg = 1;
>  		cmp += 3;
>  	}

Just remove the strstrip(), I'd say.  The kernel practically never
strips leading whitespace from sysfs input, so why do it here? 


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