[PATCH 1/2] ARM: default machine descriptor for multiplatform

Russell King - ARM Linux linux at arm.linux.org.uk
Fri Apr 19 09:28:49 EDT 2013


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.



More information about the linux-arm-kernel mailing list