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:   Wed, 15 Jun 2022 10:57:49 -0700
From:   Guenter Roeck <linux@...ck-us.net>
To:     Liang He <windhl@....com>, tharvey@...eworks.com,
        rjones@...eworks.com, jdelvare@...e.com
Cc:     linux-hwmon@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] drivers: hwmon: Add missing of_node_put() in gsc-hwmon.c

On 6/15/22 08:18, Liang He wrote:
> In gsc_hwmon_get_devtree_pdata(), of_find_compatible_node() will return
> a node pointer with refcount incremented. We should use of_node_put() in
> fail path or when it is not used anymore.
>  > Signed-off-by: Liang He <windhl@....com>
> ---

Please use proper subject lines. Here it should have been

hwmon: (gsc-hwmon) Add missing of_node_put()

>   drivers/hwmon/gsc-hwmon.c | 6 +++++-
>   1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/hwmon/gsc-hwmon.c b/drivers/hwmon/gsc-hwmon.c
> index 1fe37418ff46..34c20d13627a 100644
> --- a/drivers/hwmon/gsc-hwmon.c
> +++ b/drivers/hwmon/gsc-hwmon.c
> @@ -268,10 +268,14 @@ gsc_hwmon_get_devtree_pdata(struct device *dev)
>   
>   	/* fan controller base address */
>   	fan = of_find_compatible_node(dev->parent->of_node, NULL, "gw,gsc-fan");

A single of_node_put(fan) here would have been be sufficient.

> -	if (fan && of_property_read_u32(fan, "reg", &pdata->fan_base)) {
> +	if (fan && of_property_read_u32(fan, "reg", &pdata->fan_base)) {		
> +		of_node_put(fan);
>   		dev_err(dev, "fan node without base\n");
>   		return ERR_PTR(-EINVAL);
>   	}
> +	
> +	/* if fan&&!of_property_read_u32 fail */

This comment only adds confusion and does not add any value.

Guenter

> +	of_node_put(fan);
>   
>   	/* allocate structures for channels and count instances of each type */
>   	device_for_each_child_node(dev, child) {

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ