[PATCH 1/2] ARM: default machine descriptor for multiplatform
Arnd Bergmann
arnd at arndb.de
Fri Apr 19 10:21:54 EDT 2013
On Friday 19 April 2013, Russell King - ARM Linux wrote:
> On Fri, Apr 12, 2013 at 05:11:07PM +0200, Arnd Bergmann wrote:
> > @@ -752,7 +761,7 @@ void __init setup_arch(char **cmdline_p)
> >
> > setup_processor();
> > mdesc = setup_machine_fdt(__atags_pointer);
> > - if (!mdesc)
> > + if (!mdesc && __machine_arch_type != ~0)
> > mdesc = setup_machine_tags(__atags_pointer, __machine_arch_type);
> > machine_desc = mdesc;
> > machine_name = mdesc->name;
>
> If mdesc is NULL and __machine_arch_type is ~0, then mdesc remains NULL.
> That means machine_desc is NULL (which is probably very bad), and the
> initialization of machine_name causes a NULL pointer dereference.
>
> This is clearly wrong. mdesc must never be NULL if you're using FDT
> here, so the original code should be fine.
Ah, right. I think was a leftover from an earlier version of the
patch where I only assigned the default platform after this.
There is also a related mistake in setup_machine_fdt, the second
change is not needed there either AFAICT.
Thanks for taking a look!
Arnd
More information about the linux-arm-kernel
mailing list