[tip:sched/urgent] sched: Fix strncmp operation

From: tip-bot for Hillf Danton
Date: Fri Jan 07 2011 - 10:37:48 EST


Commit-ID: 524429c31b486c05449666b94613f59f729c0a84
Gitweb: http://git.kernel.org/tip/524429c31b486c05449666b94613f59f729c0a84
Author: Hillf Danton <dhillf@xxxxxxxxx>
AuthorDate: Thu, 6 Jan 2011 20:58:12 +0800
Committer: Ingo Molnar <mingo@xxxxxxx>
CommitDate: Fri, 7 Jan 2011 15:55:10 +0100

sched: Fix strncmp operation

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@xxxxxxxxx>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@xxxxxxxxx>
LKML-Reference: <AANLkTinOPuYsVovrZpbuCCmG5deEyc8WgA_A1RJx_YK7@xxxxxxxxxxxxxx>
Signed-off-by: Ingo Molnar <mingo@xxxxxxx>
---
kernel/sched.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/kernel/sched.c b/kernel/sched.c
index a8478a2..a0eb094 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -741,7 +741,7 @@ sched_feat_write(struct file *filp, const char __user *ubuf,
buf[cnt] = 0;
cmp = strstrip(buf);

- if (strncmp(buf, "NO_", 3) == 0) {
+ if (strncmp(cmp, "NO_", 3) == 0) {
neg = 1;
cmp += 3;
}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/