aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/sched.c
diff options
context:
space:
mode:
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>2010-09-13 17:47:00 -0400
committerIngo Molnar <mingo@elte.hu>2010-09-14 07:23:45 -0400
commit7740191cd909b75d75685fb08a5d1f54b8a9d28b (patch)
tree6a45de73bc9958d46b638d9e031a2be85568f0a4 /kernel/sched.c
parent637bbdc5b83615ef9f45f50399d1c7f27473c713 (diff)
sched: Fix string comparison in /proc/sched_features
Fix incorrect handling of the following case: INTERACTIVE INTERACTIVE_SOMETHING_ELSE The comparison only checks up to each element's length. Changelog since v1: - Embellish using some Rostedtisms. [ mingo: ^^ == smaller and cleaner ] Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Reviewed-by: Steven Rostedt <rostedt@goodmis.org> Cc: <stable@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Tony Lindgren <tony@atomide.com> LKML-Reference: <20100913214700.GB16118@Krystal> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/sched.c')
-rw-r--r--kernel/sched.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/kernel/sched.c b/kernel/sched.c
index 26f83e2f1534..b40b82e33590 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -721,7 +721,7 @@ sched_feat_write(struct file *filp, const char __user *ubuf,
721 size_t cnt, loff_t *ppos) 721 size_t cnt, loff_t *ppos)
722{ 722{
723 char buf[64]; 723 char buf[64];
724 char *cmp = buf; 724 char *cmp;
725 int neg = 0; 725 int neg = 0;
726 int i; 726 int i;
727 727
@@ -732,6 +732,7 @@ sched_feat_write(struct file *filp, const char __user *ubuf,
732 return -EFAULT; 732 return -EFAULT;
733 733
734 buf[cnt] = 0; 734 buf[cnt] = 0;
735 cmp = strstrip(buf);
735 736
736 if (strncmp(buf, "NO_", 3) == 0) { 737 if (strncmp(buf, "NO_", 3) == 0) {
737 neg = 1; 738 neg = 1;
@@ -739,9 +740,7 @@ sched_feat_write(struct file *filp, const char __user *ubuf,
739 } 740 }
740 741
741 for (i = 0; sched_feat_names[i]; i++) { 742 for (i = 0; sched_feat_names[i]; i++) {
742 int len = strlen(sched_feat_names[i]); 743 if (strcmp(cmp, sched_feat_names[i]) == 0) {
743
744 if (strncmp(cmp, sched_feat_names[i], len) == 0) {
745 if (neg) 744 if (neg)
746 sysctl_sched_features &= ~(1UL << i); 745 sysctl_sched_features &= ~(1UL << i);
747 else 746 else