public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] sched: fix strncmp operation
@ 2011-01-06 12:58 Hillf Danton
  2011-01-06 23:47 ` Andrew Morton
  2011-01-07 15:37 ` [tip:sched/urgent] sched: Fix " tip-bot for Hillf Danton
  0 siblings, 2 replies; 4+ messages in thread
From: Hillf Danton @ 2011-01-06 12:58 UTC (permalink / raw)
  To: linux-kernel; +Cc: Rik van Riel, Peter Zijlstra, Mike Galbraith

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@gmail.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;
 	}

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-01-08  4:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-06 12:58 [PATCH] sched: fix strncmp operation Hillf Danton
2011-01-06 23:47 ` Andrew Morton
2011-01-08  4:14   ` Hillf Danton
2011-01-07 15:37 ` [tip:sched/urgent] sched: Fix " tip-bot for Hillf Danton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox