[PATCH 3/3] cmd: bootefi: Honor the address & size cells properties correctly
Atish Patra
atishp at atishpatra.org
Fri Jun 19 22:16:23 CEST 2020
On Thu, Jun 18, 2020 at 11:51 PM Heinrich Schuchardt <xypron.glpk at gmx.de> wrote:
>
> On 6/19/20 3:51 AM, Atish Patra wrote:
> > fdtdec_get_addr_size reads the uses a fixed value for address & size
> > cell properties which may not be correct always.
> >
> > Use the auto variant of the function which automatically reads
> > #address-cells & #size-cells from parent and uses to read the "reg"
> > property.
> >
> > Signed-off-by: Atish Patra <atish.patra at wdc.com>
> > ---
> > cmd/bootefi.c | 5 +++--
> > 1 file changed, 3 insertions(+), 2 deletions(-)
> >
> > diff --git a/cmd/bootefi.c b/cmd/bootefi.c
> > index 0f6d0f77507c..5f3fcce597de 100644
> > --- a/cmd/bootefi.c
> > +++ b/cmd/bootefi.c
> > @@ -190,8 +190,9 @@ static void efi_carve_out_dt_rsv(void *fdt)
> > subnode = fdt_first_subnode(fdt, nodeoffset);
> > while (subnode >= 0) {
> > /* check if this subnode has a reg property */
> > - addr = fdtdec_get_addr_size(fdt, subnode, "reg",
> > - (fdt_size_t *)&size);
> > + addr = fdtdec_get_addr_size_auto_parent(fdt, nodeoffset,
> > + subnode, "reg", 0,
> > + (fdt_size_t *)&size, false);
>
> On qemu_arm_defconfig: sizeof(fdt_size_t) = 4, sizeof(u64) = 8. So after
> the call the upper four bytes of size will be random bytes from the stack.
>
Ah yes. Thanks for catching that and the quick fix.
> Best regards
>
> Heinrich
>
> > /*
> > * The /reserved-memory node may have children with
> > * a size instead of a reg property.
> >
>
--
Regards,
Atish
More information about the U-Boot
mailing list