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:   Tue, 21 Dec 2021 22:08:42 +0000
From:   Daniel Scally <djrscally@...il.com>
To:     Clément Léger <clement.leger@...tlin.com>
Cc:     Andy Shevchenko <andy.shevchenko@...il.com>,
        Sakari Ailus <sakari.ailus@...ux.intel.com>,
        Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
        Heikki Krogerus <heikki.krogerus@...ux.intel.com>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        "Rafael J . Wysocki" <rafael@...nel.org>,
        "linux-acpi@...r.kernel.org" <linux-acpi@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] software node: fix wrong node passed to find nargs_prop

Hello

On 21/12/2021 09:46, Clément Léger wrote:
> Le Mon, 20 Dec 2021 23:37:07 +0000,
> Daniel Scally <djrscally@...il.com> a écrit :
> 
>> Thanks Andy
>>
>> On 20/12/2021 22:13, Andy Shevchenko wrote:
>>  [...]  
>>
>> I think this is right (it's not used in the ACPI version, and the OF
>> version is quite convoluted so a bit hard to follow)...but also I note
>> that none of the users of fwnode_property_get_reference_args() pass
>> anything to nargs_prop anyway...do we even need this?
> 
> Indeed, this is currently not used anywhere, nargs is always used
> instead of nargs_prop. The usage is meant to be (almost) the same as
> of_parse_phandle_with_args().
> 
> ie:
> 
>  ret = of_parse_phandle_with_args(node, "resets", "#reset-cells",
> 				  index, &args);
> 
> can be replaced by:
> 
>  ret = fwnode_property_get_reference_args(node, "resets",
> 					  "#reset-cells", 0 index,
> 					  &args);
> 
> I have some patches that uses that with software nodes and that will
> need this support.

Ok, in that case I think this is the right thing to do and you can have my:

Reviewed-by: Daniel Scally <djrscally@...il.com>

Might be nice to transfer the function comment from
of_parse_phandle_with_args() to fwnode_property_get_reference_args(), as
that's nice and clear.

>>
>> Use the correct reference node in call to
>>>     property_entry_read_int_array() to retrieve the correct nargs value.
>>>
>>>     Fixes: b06184acf751 ("software node: Add
>>>     software_node_get_reference_args()")  
>>
>> I think this might have been introduced later...maybe 996b0830f95d1,
>> maybe e933bedd45099
> 
> From what I saw, it was already in the original commit adding this but
> I can be wrong.

You're right of course - sorry for the noise

>>
>>>     Signed-off-by: Clément Léger <clement.leger@...tlin.com
>>>     <mailto:clement.leger@...tlin.com>>
>>>     ---
>>>      drivers/base/swnode.c | 2 +-
>>>      1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>>     diff --git a/drivers/base/swnode.c b/drivers/base/swnode.c
>>>     index 4debcea4fb12..0a482212c7e8 100644
>>>     --- a/drivers/base/swnode.c
>>>     +++ b/drivers/base/swnode.c
>>>     @@ -529,7 +529,7 @@ software_node_get_reference_args(const struct
>>>     fwnode_handle *fwnode,
>>>                     return -ENOENT;
>>>
>>>             if (nargs_prop) {
>>>     -               error =
>>>     property_entry_read_int_array(swnode->node->properties,
>>>     +               error =
>>>     property_entry_read_int_array(ref->node->properties,
>>>                                                           nargs_prop,
>>>     sizeof(u32),
>>>                                                          
>>>     &nargs_prop_val, 1);
>>>                     if (error)
>>>     -- 
>>>     2.34.1
>>>
>>>
>>>
>>> -- 
>>> With Best Regards,
>>> Andy Shevchenko
>>>
>>>   
> 
> 
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ