lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 25 Mar 2020 13:07:41 -0600
From:   Rob Herring <robh+dt@...nel.org>
To:     Rayagonda Kokatanur <rayagonda.kokatanur@...adcom.com>
Cc:     Frank Rowand <frowand.list@...il.com>, devicetree@...r.kernel.org,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "maintainer:BROADCOM BCM7XXX ARM ARCHITECTURE" 
        <bcm-kernel-feedback-list@...adcom.com>
Subject: Re: [PATCH v1 1/1] scripts: dtc: mask flags bit when check i2c addr

On Mon, Mar 2, 2020 at 9:56 PM Rayagonda Kokatanur
<rayagonda.kokatanur@...adcom.com> wrote:
>
> On Fri, Feb 28, 2020 at 7:20 PM Rob Herring <robh+dt@...nel.org> wrote:
> >
> > On Fri, Feb 28, 2020 at 2:48 AM Rayagonda Kokatanur
> > <rayagonda.kokatanur@...adcom.com> wrote:
> > >
> > > Generally i2c addr should not be greater than 10-bit. The highest 2 bits
> > > are used for I2C_TEN_BIT_ADDRESS and I2C_OWN_SLAVE_ADDRESS. Need to mask
> > > these flags if check slave addr valid.
> > >
> > > Signed-off-by: Rayagonda Kokatanur <rayagonda.kokatanur@...adcom.com>
> > > ---
> > >  scripts/dtc/Makefile | 2 +-
> > >  scripts/dtc/checks.c | 5 +++++
> > >  2 files changed, 6 insertions(+), 1 deletion(-)
> >
> > dtc changes must be submitted against upstream dtc.
>
> Please let me know link to clone the upstream dtc branch.
> >
> >
> > > diff --git a/scripts/dtc/Makefile b/scripts/dtc/Makefile
> > > index 3acbb410904c..c5e8d6a9e73c 100644
> > > --- a/scripts/dtc/Makefile
> > > +++ b/scripts/dtc/Makefile
> > > @@ -9,7 +9,7 @@ dtc-objs        := dtc.o flattree.o fstree.o data.o livetree.o treesource.o \
> > >  dtc-objs       += dtc-lexer.lex.o dtc-parser.tab.o
> > >
> > >  # Source files need to get at the userspace version of libfdt_env.h to compile
> > > -HOST_EXTRACFLAGS := -I $(srctree)/$(src)/libfdt
> > > +HOST_EXTRACFLAGS := -I $(srctree)/$(src)/libfdt -I$(srctree)/tools/include
> > >
> > >  ifeq ($(shell pkg-config --exists yaml-0.1 2>/dev/null && echo yes),)
> > >  ifneq ($(CHECK_DTBS),)
> > > diff --git a/scripts/dtc/checks.c b/scripts/dtc/checks.c
> > > index 756f0fa9203f..17c9ed4137b5 100644
> > > --- a/scripts/dtc/checks.c
> > > +++ b/scripts/dtc/checks.c
> > > @@ -3,6 +3,7 @@
> > >   * (C) Copyright David Gibson <dwg@....ibm.com>, IBM Corporation.  2007.
> > >   */
> > >
> > > +#include <linux/bits.h>
> >
> > Not a UAPI header not that that would be much better as dtc also builds on Mac.
> >
> > >  #include "dtc.h"
> > >  #include "srcpos.h"
> > >
> > > @@ -17,6 +18,9 @@
> > >  #define TRACE(c, fmt, ...)     do { } while (0)
> > >  #endif
> > >
> > > +#define I2C_TEN_BIT_ADDRESS    BIT(31)
> > > +#define I2C_OWN_SLAVE_ADDRESS  BIT(30)
> > > +
> > >  enum checkstatus {
> > >         UNCHECKED = 0,
> > >         PREREQ,
> > > @@ -1048,6 +1052,7 @@ static void check_i2c_bus_reg(struct check *c, struct dt_info *dti, struct node
> > >
> > >         for (len = prop->val.len; len > 0; len -= 4) {
> > >                 reg = fdt32_to_cpu(*(cells++));
> > > +               reg &= ~(I2C_OWN_SLAVE_ADDRESS | I2C_TEN_BIT_ADDRESS);
> >
> > I'd just mask the top byte so we don't have to update on the next flag we add.
> Do you mean something like this, shown below ?
> reg &= 0xFFFF_FC000;

Yes, but as I said, the 'top byte', so 0xFF000000.

Rob

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ