]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
fdt_resize(): ensure minimum padding
authorPeter Korsgaard <jacmet@sunsite.dk>
Tue, 28 Oct 2008 07:26:52 +0000 (08:26 +0100)
committerGerald Van Baren <vanbaren@cideas.com>
Fri, 31 Oct 2008 00:37:57 +0000 (20:37 -0400)
fdt_add_mem_rsv() requires space for a struct fdt_reserve_entry
(16 bytes), so make sure that fdt_resize at least adds that much
padding, no matter what the location or size of the fdt is.

Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
Acked-by: Andy Fleming <afleming@freescale.com>
common/fdt_support.c

index d483d66f11d2e8b7cb17d516927d72d4b9fd09eb..5a83bca48177d738f6d493283214ac6ca099167e 100644 (file)
@@ -602,9 +602,12 @@ int fdt_resize(void *blob)
                }
        }
 
-       /* Calculate the actual size of the fdt */
+       /*
+        * Calculate the actual size of the fdt
+        * plus the size needed for fdt_add_mem_rsv
+        */
        actualsize = fdt_off_dt_strings(blob) +
-               fdt_size_dt_strings(blob);
+               fdt_size_dt_strings(blob) + sizeof(struct fdt_reserve_entry);
 
        /* Make it so the fdt ends on a page boundary */
        actualsize = ALIGN(actualsize, 0x1000);