Commit dfaa9c94b13071c9b5f8578d0ae99acc76c60139
Committed by
Linus Torvalds
1 parent
5418b6925c
Exists in
master
and in
7 other branches
[PATCH] profile.c: `schedule' parsing fix
profile=schedule parsing is not quite what it should be. First, str[7] is 'e', not ',', but then even if it did fall through, prof_on = SCHED_PROFILING would be clobbered inside if (get_option(...)) So a small amount of rearrangement is done in this patch to correct it. Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Showing 1 changed file with 10 additions and 6 deletions Side-by-side Diff
kernel/profile.c
... | ... | @@ -49,15 +49,19 @@ |
49 | 49 | |
50 | 50 | static int __init profile_setup(char * str) |
51 | 51 | { |
52 | + static char __initdata schedstr[] = "schedule"; | |
52 | 53 | int par; |
53 | 54 | |
54 | - if (!strncmp(str, "schedule", 8)) { | |
55 | + if (!strncmp(str, schedstr, strlen(schedstr))) { | |
55 | 56 | prof_on = SCHED_PROFILING; |
56 | - printk(KERN_INFO "kernel schedule profiling enabled\n"); | |
57 | - if (str[7] == ',') | |
58 | - str += 8; | |
59 | - } | |
60 | - if (get_option(&str,&par)) { | |
57 | + if (str[strlen(schedstr)] == ',') | |
58 | + str += strlen(schedstr) + 1; | |
59 | + if (get_option(&str, &par)) | |
60 | + prof_shift = par; | |
61 | + printk(KERN_INFO | |
62 | + "kernel schedule profiling enabled (shift: %ld)\n", | |
63 | + prof_shift); | |
64 | + } else if (get_option(&str, &par)) { | |
61 | 65 | prof_shift = par; |
62 | 66 | prof_on = CPU_PROFILING; |
63 | 67 | printk(KERN_INFO "kernel profiling enabled (shift: %ld)\n", |