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:   Fri, 11 Sep 2020 23:26:43 +0200
From:   Jacek Anaszewski <jacek.anaszewski@...il.com>
To:     Alexander Dahl <post@...pocky.de>, linux-leds@...r.kernel.org,
        devicetree@...r.kernel.org
Cc:     Pavel Machek <pavel@....cz>, Dan Murphy <dmurphy@...com>,
        Rob Herring <robh+dt@...nel.org>, linux-kernel@...r.kernel.org,
        Peter Ujfalusi <peter.ujfalusi@...com>,
        Alexander Dahl <ada@...rsis.com>
Subject: Re: [PATCH v4 1/3] leds: Require valid fwnode pointer for composing
 name

Hi Alexander,

On 9/11/20 5:40 PM, Alexander Dahl wrote:
> The function 'led_compose_name()' is called in
> 'led_classdev_register_ext(()' only and in its implementation it always
> parses the fwnode passed with the init_data struct.  If there's no
> fwnode, EINVAL is returned and 'led_classdev_register_ext()' returns
> early.
> 
> If this is detected early the same fallback mechanism can be used , as
> if init_data itself is NULL.  This will allow drivers to pass fully
> populated 'init_data' or sparse initialized 'init_data' with a NULL
> fwnode in a more elegant way with only one function call.
> 
> Fixes: bb4e9af0348d ("leds: core: Add support for composing LED class device names")
> Suggested-by: Pavel Machek <pavel@....cz>
> Signed-off-by: Alexander Dahl <post@...pocky.de>
> ---
> 
> Notes:
>      v4:
>        * added this patch to series (Suggested-by: Pavel Machek)
> 
>   drivers/leds/led-class.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/leds/led-class.c b/drivers/leds/led-class.c
> index cc3929f858b6..3da50c7ecfe7 100644
> --- a/drivers/leds/led-class.c
> +++ b/drivers/leds/led-class.c
> @@ -346,7 +346,7 @@ int led_classdev_register_ext(struct device *parent,
>   	const char *proposed_name = composed_name;
>   	int ret;
>   
> -	if (init_data) {
> +	if (init_data && init_data->fwnode) {

This does not cover the case when we don't have fwnode but we
have init_data->default_label that led_compose_name() can make use of.

>   		if (init_data->devname_mandatory && !init_data->devicename) {
>   			dev_err(parent, "Mandatory device name is missing");
>   			return -EINVAL;
> 

-- 
Best regards,
Jacek Anaszewski

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ