Re: [PATCH 01/12] libfdt: Clean up header checking functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



On Fri, Mar 30, 2018 at 04:42:15PM +0800, Simon Glass wrote:
> Hi David,
> 
> On 26 March 2018 at 07:25, David Gibson <david@xxxxxxxxxxxxxxxxxxxxx> wrote:
> > Many of the libfdt entry points call some sort of sanity check function
> > before doing anything else.  These need to do slightly different things for
> > the various classes of functions.
> >
> > The read-only version is shared with the exported fdt_check_header(), which
> > limits us a bit in how we can improve it.  For that reason split the two
> > functions apart (though the exported one just calls the ro one for now).
> >
> > We also rename the functions for more consistency - they're all named
> > fdt_XX_probe_() where the XX indicates which class of functions they're
> > for.  "probe" is a better "term" than the previous check, since they really
> > only do minimal validation.
> >
> > Signed-off-by: David Gibson <david@xxxxxxxxxxxxxxxxxxxxx>
> > ---
> >  libfdt/fdt.c             |  9 +++++++--
> >  libfdt/fdt_overlay.c     |  6 +++---
> >  libfdt/fdt_ro.c          | 18 +++++++++---------
> >  libfdt/fdt_rw.c          | 28 ++++++++++++++--------------
> >  libfdt/fdt_sw.c          | 18 +++++++++---------
> >  libfdt/libfdt_internal.h |  6 ++++--
> 
> Can you add comments to this file to explain what the new functions actually do?

I'm not really sure what you're after here.  I'm not sure how to
summarize it better than "basic sanity checks for an fdt".  For more
details the code is trivial and this commit message will be there.

> >  6 files changed, 46 insertions(+), 39 deletions(-)
> 
> Also what do you think about a build option to disable these checks?
> They might increase code size for small environments. Some build
> systems will be able to ensure that the DT is valid and won't want
> these checks.

I'm very disinclined to do this unless someone has a *concrete*
example of it causing problems.  Introducing build options will
dramatically increase testing complexity.

Out of interest, I checked on my system (x86 Linux, gcc 7.3.1 and -Os)
and the size change is a mere 21 bytes.

-- 
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


[Index of Archives]     [Device Tree]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux