diff options
author | Dave Hansen <dave.hansen@linux.intel.com> | 2015-12-22 14:52:38 -0800 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2016-02-03 12:03:15 +0100 |
commit | 02afeaae9843733a39cd9b11053748b2d1dc5ae7 (patch) | |
tree | 96fb49caf6bcb77338ce7be1b2d357b4948de231 /arch/arm/mach-spear/spear3xx.c | |
parent | a4733143085d6c782ac1e6c85778655b6bac1d4e (diff) | |
download | op-kernel-dev-02afeaae9843733a39cd9b11053748b2d1dc5ae7.zip op-kernel-dev-02afeaae9843733a39cd9b11053748b2d1dc5ae7.tar.gz |
x86/boot: Fix early command-line parsing when matching at end
The x86 early command line parsing in cmdline_find_option_bool() is
buggy. If it matches a specified 'option' all the way to the end of the
command-line, it will consider it a match.
For instance,
cmdline = "foo";
cmdline_find_option_bool(cmdline, "fool");
will return 1. This is particularly annoying since we have actual FPU
options like "noxsave" and "noxsaves" So, command-line "foo bar noxsave"
will match *BOTH* a "noxsave" and "noxsaves". (This turns out not to be
an actual problem because "noxsave" implies "noxsaves", but it's still
confusing.)
To fix this, we simplify the code and stop tracking 'len'. 'len'
was trying to indicate either the NULL terminator *OR* the end of a
non-NULL-terminated command line at 'COMMAND_LINE_SIZE'. But, each of the
three states is *already* checking 'cmdline' for a NULL terminator.
We _only_ need to check if we have overrun 'COMMAND_LINE_SIZE', and that
we can do without keeping 'len' around.
Also add some commends to clarify what is going on.
Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: fenghua.yu@intel.com
Cc: yu-cheng.yu@intel.com
Link: http://lkml.kernel.org/r/20151222225238.9AEB560C@viggo.jf.intel.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'arch/arm/mach-spear/spear3xx.c')
0 files changed, 0 insertions, 0 deletions