Re: [PATCH] ARM: Fix incorrect FDT initrd parameter override
From: Jason Cooper <hidden>
Date: 2014-01-13 21:28:34
Also in:
linux-arm-kernel
Ben, On Tue, Jan 14, 2014 at 07:08:30AM +1000, Ben Peddell wrote:
Patch submitted with requested changes. On Mon, 13 Jan 2014 at 10:28:51 AM -0500, Jason Cooper wrote:quoted
quoted
+ initrd_start = initrd_end = 0;This line shouldn't be necessary. Both are reset in the following hunk below your change:if (phys_initrd_size && !memblock_is_region_memory(phys_initrd_start, phys_initrd_size)) { pr_err("INITRD: 0x%08llx+0x%08lx is not a memory region - disabling initrd\n", (u64)phys_initrd_start, phys_initrd_size); phys_initrd_start = phys_initrd_size = 0; } if (phys_initrd_size && memblock_is_region_reserved(phys_initrd_start, phys_initrd_size)) { pr_err("INITRD: 0x%08llx+0x%08lx overlaps in-use memory region - disabling initrd\n", (u64)phys_initrd_start, phys_initrd_size); phys_initrd_start = phys_initrd_size = 0; }quoted
if (phys_initrd_size) { memblock_reserve(phys_initrd_start, phys_initrd_size); /* Now convert initrd to virtual addresses */ initrd_start = __phys_to_virt(phys_initrd_start); initrd_end = initrd_start + phys_initrd_size; }Please note that above this a check is made to ensure that phys_initrd_start and phys_initrd_size are valid, and they are zeroed if they are not valid. Therefore if phys_initrd_start or phys_initrd_size are invalid, then initrd_start and initrd_end are not reset. This means that if the initrd= address is not present or is invalid then the FDT address will be used anyway as initrd_start and initrd_end will not have been zeroed, and if that is invalid the kernel will OOPS in unpack_to_rootfs():
Ahhh, ok. Thanks for the clarification. You kept that line in the version you submitted to Russell's patch tracker? thx, Jason. -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html