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]
Message-ID: <Yj3SFYdUQ4r7GXqs@smile.fi.intel.com>
Date:   Fri, 25 Mar 2022 16:30:45 +0200
From:   Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To:     Clément Léger <clement.leger@...tlin.com>
Cc:     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@...r.kernel.org, linux-acpi@...r.kernel.org,
        linux-i2c@...r.kernel.org, devicetree@...r.kernel.org
Subject: Re: [PATCH v3 3/9] device property: add index argument to
 property_read_string_array() callback

On Fri, Mar 25, 2022 at 12:31:42PM +0100, Clément Léger wrote:
> This will allow to read a string array from a specified offset. Support
> for this new parameter has been added in both of through the use of
> of_property_read_string_array_index() and in swnode though the existing
> property_entry_read_string_array() function. ACPI support has not yet
> been added and only index == 0 is accepted.

...

>  static int
>  acpi_fwnode_property_read_string_array(const struct fwnode_handle *fwnode,
>  				       const char *propname, const char **val,
> -				       size_t nval)
> +				       size_t nval, int index)
>  {
> +	if (index != 0)
> +		return -EINVAL;
> +
>  	return acpi_node_prop_read(fwnode, propname, DEV_PROP_STRING,
>  				   val, nval);

I guess it would be nice if some of us (ACPI folks) can provide a proper
prerequisite patch.

...

> -	array_len = min_t(size_t, nval, array_len);
>  	length = array_len * sizeof(*strings);

> -

Stray change.

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

...

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

-- 
With Best Regards,
Andy Shevchenko


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ