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] [day] [month] [year] [list]
Message-ID: <hg5gxn3ck3muwix5fgapdwxrqt7jkaqsv6qsiyanntulfjr2fw@lptgumpwbhqp>
Date: Fri, 26 Jul 2024 09:35:28 +0200
From: Marek BehĂșn <kabel@...nel.org>
To: Chen Ni <nichen@...as.ac.cn>
Cc: pavel@....cz, lee@...nel.org, linux-leds@...r.kernel.org, 
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] leds: ns2: add missing check for
 fwnode_property_read_u32_array

On Thu, Jul 25, 2024 at 04:15:37PM +0800, Chen Ni wrote:
> Add check for the return value of fwnode_property_read_u32_array() and
> return the error if it fails in order to catch the error.
> 
> Fixes: 940cca1ab5d6 ("leds: ns2: convert to fwnode API")
> Signed-off-by: Chen Ni <nichen@...as.ac.cn>
> ---
>  drivers/leds/leds-ns2.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/leds/leds-ns2.c b/drivers/leds/leds-ns2.c
> index f3010c472bbd..0713f7e9d1af 100644
> --- a/drivers/leds/leds-ns2.c
> +++ b/drivers/leds/leds-ns2.c
> @@ -202,8 +202,12 @@ static int ns2_led_register(struct device *dev, struct fwnode_handle *node,
>  	if (!modval)
>  		return -ENOMEM;
>  
> -	fwnode_property_read_u32_array(node, "modes-map", (void *)modval,
> -				       nmodes * 3);
> +	ret = fwnode_property_read_u32_array(node, "modes-map", (void *)modval,
> +					     nmodes * 3);
> +	if (ret) {
> +		dev_err(dev, "Missing modes-map property for %pfw\n", node);
> +		return ret;
> +	}

Please use
  return dev_err_probe()

also maybe in other parts of the driver probe where
  dev_err();
  return ret;
is being done.

The device_for_each_child_node() can be changed to
device_for_each_child_node_scoped() and you can drop the fwnode_handle_put()
from
  if (ret) {
    fwnode_handle_put(child);
    return ret;
  }

Marek

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ