Skip to contentSkip to conversation

Possible NULL pointer dereference in m32r

DISCUSSION Steve Kemp 1 participant 1 message Feb 1, 2010

lore
Share & tools
lore

Steve Kemp

author
#0 lore raw

arch/m32r/kernel/smp.c contains the following code:

--

    preempt_disable();
    cpu_id = smp_processor_id();
    mmc = &mm->context[cpu_id];
    cpu_mask = mm->cpu_vm_mask;
    cpu_clear(cpu_id, cpu_mask);

#iffdef DEBUG_SMP
if (!mm)

       BUG();

#endif
--

mm might be NULL, but this would only be detected after it
has been dereferenced, and only then if DEBUG_SMP is defined.

I'd suggest changing to read something like this:

--

    if ( !mm )
        BUG();

    preempt_disable();

--

Steve
--
http://www.steve.org.uk/