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  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:   Tue, 5 Apr 2022 15:22:51 +0200
From:   "Rafael J. Wysocki" <rafael@...nel.org>
To:     Clément Léger <clement.leger@...tlin.com>
Cc:     Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
        Daniel Scally <djrscally@...il.com>,
        Heikki Krogerus <heikki.krogerus@...ux.intel.com>,
        Sakari Ailus <sakari.ailus@...ux.intel.com>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        "Rafael J . Wysocki" <rafael@...nel.org>,
        Wolfram Sang <wsa@...nel.org>, Peter Rosin <peda@...ntia.se>,
        Rob Herring <robh+dt@...nel.org>,
        Frank Rowand <frowand.list@...il.com>,
        Len Brown <lenb@...nel.org>,
        Hans de Goede <hdegoede@...hat.com>,
        Thomas Petazzoni <thomas.petazzoni@...tlin.com>,
        Alexandre Belloni <alexandre.belloni@...tlin.com>,
        Allan Nielsen <allan.nielsen@...rochip.com>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        ACPI Devel Maling List <linux-acpi@...r.kernel.org>,
        linux-i2c <linux-i2c@...r.kernel.org>,
        "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" 
        <devicetree@...r.kernel.org>
Subject: Re: [PATCH v3 3/9] device property: add index argument to
 property_read_string_array() callback

On Mon, Mar 28, 2022 at 4:29 PM Clément Léger <clement.leger@...tlin.com> wrote:
>
> Le Fri, 25 Mar 2022 16:30:45 +0200,
> Andy Shevchenko <andriy.shevchenko@...ux.intel.com> a écrit :
>
> > >     pointer = property_entry_find(props, propname, length);
> > >     if (IS_ERR(pointer))
> > >             return PTR_ERR(pointer);
> >
> > > +   if (index >= array_len)
> > > +           return -ENODATA;
> >
> > I was about to ask if we can check this before the
> > property_entry_find() call, but realized that in such case it will
> > shadow possible errors due to wrong or absent property.
>
> I think you are actually right, the check can be done after
> property_entry_count_elems_of_size() since it already checks for the
> property to be present. I'll move that check.
>
> >
> > ...
> >
> > > -           of_property_read_string_array(node, propname, val,
> > > nval) :
> > > +           of_property_read_string_array_index(node,
> > > propname, val, nval,
> > > +                                               index) :
> >
> > Dunno about the style there, but I think it can be one line.
>
> Seems like the complete file is strictly applying the 80 columns rules
> so I thought it was better to keep it like this. However, I think the
> ternary oeprator is not really readable with such split.

So FWIW I would entirely change it to

if (!val)
        return of_property_count_strings(node, propname);

return of_property_read_string_array_index(node, propname, val,

nval, index);

which IMO would be way easier to read.

Powered by blists - more mailing lists