Skip to content

Commit

Permalink
sched: Fix strncmp operation
Browse files Browse the repository at this point in the history
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>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <AANLkTinOPuYsVovrZpbuCCmG5deEyc8WgA_A1RJx_YK7@mail.gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
  • Loading branch information
Hillf Danton authored and Ingo Molnar committed Jan 7, 2011
1 parent 1c5354d commit 524429c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion kernel/sched.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 524429c

Please sign in to comment.