1. 03 2月, 2016 1 次提交
    • D
      x86/boot: Fix early command-line parsing when matching at end · 02afeaae
      Dave Hansen 提交于
      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: NDave Hansen <dave.hansen@linux.intel.com>
      Signed-off-by: NBorislav 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.comSigned-off-by: NIngo Molnar <mingo@kernel.org>
      02afeaae
  2. 21 5月, 2014 1 次提交