[PATCH v2] tools: ensure zeroed padding in external FIT images
Roman Azarenko
roman.azarenko at iopsys.eu
Mon Aug 28 10:00:01 CEST 2023
On Fri, 2023-08-25 at 12:06 -0600, Simon Glass wrote:
> > @@ -564,9 +564,13 @@ static int fit_extract_data(struct
> > image_tool_params *params, const char *fname)
> > /* Pack the FDT and place the data after it */
> > fdt_pack(fdt);
> >
> > - new_size = fdt_totalsize(fdt);
> > - new_size = ALIGN(new_size, align_size);
> > + unpadded_size = fdt_totalsize(fdt);
> > + new_size = ALIGN(unpadded_size, align_size);
> > fdt_set_totalsize(fdt, new_size);
>
> I didn't know that was allowed...I thought it needed fdt_open_into() ?
The introduction of fdt_set_totalsize() comes from commit ebfe611be91e
("mkimage: fit_image: Add option to make fit header align"). The commit
message doesn't describe the choice of this function vs fdt_open_into().
Personally I'm unable to definitively comment on it. I can only blindly
guess, that because we're only changing the total length of the fdt
struct, and keeping all other fields the same, we don't need to allocate
a new fdt struct with a different size.
More information about the U-Boot
mailing list