ARM: 7380/1: DT: do not add a zero-sized memory property
authorMarc Zyngier <Marc.Zyngier@arm.com>
Wed, 11 Apr 2012 13:52:56 +0000 (14:52 +0100)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Fri, 13 Apr 2012 13:05:41 +0000 (14:05 +0100)
Some bootloaders are broken enough to expose an ATAG_MEM with
a null size. Converting such tag to a memory node leads to
an unbootable system.

Skip over zero sized ATAG_MEM to avoid this situation.

Acked-by: Nicolas Pitre <nicolas.pitre@linaro.org>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
arch/arm/boot/compressed/atags_to_fdt.c

index 6ce11c4..797f04b 100644 (file)
@@ -77,6 +77,8 @@ int atags_to_fdt(void *atag_list, void *fdt, int total_space)
                } else if (atag->hdr.tag == ATAG_MEM) {
                        if (memcount >= sizeof(mem_reg_property)/4)
                                continue;
+                       if (!atag->u.mem.size)
+                               continue;
                        mem_reg_property[memcount++] = cpu_to_fdt32(atag->u.mem.start);
                        mem_reg_property[memcount++] = cpu_to_fdt32(atag->u.mem.size);
                } else if (atag->hdr.tag == ATAG_INITRD2) {