Hi David, On Mon, 22 Jul 2019 at 01:25, David Gibson <david@xxxxxxxxxxxxxxxxxxxxx> wrote: > > On Sat, Jul 20, 2019 at 05:31:08PM -0600, Simon Glass wrote: > > This file provides read-only access to the device tree and includes many > > sanity checks. Allow these checks to be disabled to reduce code size. > > > > Signed-off-by: Simon Glass <sjg@xxxxxxxxxxxx> > > --- > > > > libfdt/fdt_ro.c | 73 +++++++++++++++++++++++++++++++------------------ > > 1 file changed, 47 insertions(+), 26 deletions(-) > > > > diff --git a/libfdt/fdt_ro.c b/libfdt/fdt_ro.c > > index 6fd9ec1..bc1b4e0 100644 > > --- a/libfdt/fdt_ro.c > > +++ b/libfdt/fdt_ro.c > > @@ -14,9 +14,13 @@ static int fdt_nodename_eq_(const void *fdt, int offset, > > const char *s, int len) > > { > > int olen; > > - const char *p = fdt_get_name(fdt, offset, &olen); > > + const char *p; > > > > - if (!p || olen < len) > > + if (_check2()) > > + p = fdt_get_name(fdt, offset, &olen); > > + else > > + p = fdt_offset_ptr(fdt, offset + FDT_TAGSIZE, len+1); > > Here we're not just excising code based on check level but taking a > different path. This makes me nervous about fragility - I'd be a lot > more comfortable if we could somehow extend the testsuite to run at > all the different check levels (except for tests that clearly rely on > the extra checking, obviously). Yes, and I think I might as well revert this as there is not much code-size improvement. I just noticed that the old code was a single line so thought I'd use that. Re tests, yes I think we need to check all check levels. Let's see what you think of the mask vs. level thing in v2, and once we have that figured out, i'll take a look. [..] Regards, Simon