On Thu, Aug 13, 2020 at 09:55:09AM +0200, Frank Mehnert wrote: > fdt_check_node_offset_() checks for a valid offset but also changes the > offset by calling fdt_next_tag(). Hence, do not skip this function if > ASSUME_VALID_INPUT is set. > > Actually this works similar to fdt_check_prop_offset_(). Correct, but we can do better. We can still elide the checks for offset < 0 and offset % FDT_TAGSIZE when VALID_INPUT is set. > --- > libfdt/fdt.c | 2 -- > 1 file changed, 2 deletions(-) > > diff --git a/libfdt/fdt.c b/libfdt/fdt.c > index c28fcc1..39ed8ed 100644 > --- a/libfdt/fdt.c > +++ b/libfdt/fdt.c > @@ -206,8 +206,6 @@ uint32_t fdt_next_tag(const void *fdt, int startoffset, int *nextoffset) > > int fdt_check_node_offset_(const void *fdt, int offset) > { > - if (can_assume(VALID_INPUT)) > - return offset; > if ((offset < 0) || (offset % FDT_TAGSIZE) > || (fdt_next_tag(fdt, offset, &offset) != FDT_BEGIN_NODE)) > return -FDT_ERR_BADOFFSET; -- David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson
Attachment:
signature.asc
Description: PGP signature