• Andrew Morton's avatar
    [PATCH] Fix i386/x86_64 cpuid/msr BUG() on impossible CPUs · c3ca375d
    Andrew Morton authored
    From: Rusty Russell <rusty@rustcorp.com.au>
    
    Matthieu Castet <castet.matthieu@free.fr> pointed out that testing
    cpu_online(cpu) on a UP system goes BUG().
    
    That's because you're never supposed to ask cpu_online() about a CPU which
    is >= NR_CPUS.  msr and cpuid devices use the minor to indicate the CPU
    number.  Oops.
    
    Fix is to explicitly test cpu < NR_CPUS.  Using cpu_online() is OK;
    although the CPU might go down before you actually read the file, that will
    simply cause junk to be returned.
    c3ca375d
cpuid.c 3.77 KB