[PATCH] Fix the Kernel Crash if Initrd is not passed in Device tree

Grant Likely grant.likely at secretlab.ca
Fri Sep 24 05:16:32 EST 2010


On Mon, Sep 20, 2010 at 03:58:54PM +0530, Shaju Abraham wrote:
> The code should check for the size of the phys_initrd_size rather than
> phys_devtree_size before calling memblock_reserve().If initrd is not passed
> from the Device Tree  the parameters phys_initrd_start, and phys_initrd_size are
> zeros.The kernel complaints with a BUG if the arguments passed to memblock_reserve
> are zeroes.
> 
> Signed-off-by: Shaju Abraham <shaju.abraham at linaro.org>
> ---
> This patch applies to Grant Likely's tree test-devtree branch
> 
>  arch/arm/mm/init.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c
> index 9ddace8..018b76e 100644
> --- a/arch/arm/mm/init.c
> +++ b/arch/arm/mm/init.c
> @@ -310,7 +310,7 @@ void __init arm_memblock_init(struct meminfo *mi, struct machine_desc *mdesc)
>  	}
>  #endif
>  #ifdef CONFIG_OF_FLATTREE
> -	if (phys_devtree_size)
> +	if (phys_initrd_size)
>  		memblock_reserve(phys_initrd_start, phys_initrd_size);

No, this is actually a bug in the memblock_reserve() line.
phys_devtree_start and phys_devtree_size should have been passed to
memblock_reserve().  This is now fixed in my tree.



More information about the devicetree-discuss mailing list