[U-Boot] libfdt: make fdt_increase_size() available to everyone

Timur Tabi timur at freescale.com
Sun May 16 06:13:13 CEST 2010


On Sat, May 15, 2010 at 9:11 PM, Gerald Van Baren <gvb.uboot at gmail.com> wrote:

> The code has one pre-existing weakness that bothers me: if there is
> something following the FDT blob, it will get overwritten by the
> increased blob.  One way around this would be to malloc() a new memory
> space and move and expand the blob to the new space.  The first time
> this was done, the original blob should not be free()ed since it wasn't
> malloc()ed, but the second and subsequent times it should be free()ed.

But then how does the caller know where the new blob is?  When I call
fdt_increase_size(), I pass it the address of a blob that I'm
modifying.  After the function returns, my value of 'fdt' is no longer
valid.

> I've added this to your patch, but have *NOT* execution tested it.  Does
> this addition (a) make sense and (b) work?

I was expecting the caller of fdt_increase_size() to know that the
space after the fdt is available.

-- 
Timur Tabi
Linux kernel developer at Freescale


More information about the U-Boot mailing list