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:   Thu, 13 Feb 2020 09:18:25 +0100
From:   Uwe Kleine-König 
        <u.kleine-koenig@...gutronix.de>
To:     Anson Huang <Anson.Huang@....com>
Cc:     linux@...linux.org.uk, shawnguo@...nel.org, s.hauer@...gutronix.de,
        kernel@...gutronix.de, festevam@...il.com, allison@...utok.net,
        tglx@...utronix.de, andrew.smirnov@...il.com,
        kstewart@...uxfoundation.org, gregkh@...uxfoundation.org,
        rfontana@...hat.com, sakari.ailus@...ux.intel.com,
        bhelgaas@...gle.com, dsterba@...e.com, peng.fan@....com,
        okuno.kohji@...panasonic.com, linux-arm-kernel@...ts.infradead.org,
        linux-kernel@...r.kernel.org, Linux-imx@....com
Subject: Re: [PATCH V2] ARM: imx: Add missing of_node_put()

On Thu, Feb 13, 2020 at 02:20:54PM +0800, Anson Huang wrote:
> After finishing using device node got from of_find_compatible_node(),
> of_node_put() needs to be called.
> 
> Signed-off-by: Anson Huang <Anson.Huang@....com>
> ---
> Changes since V1:
> 	- correct some of_node_put() place to make sure it is safe to be put.
> ---
>  arch/arm/mach-imx/anatop.c     | 3 +++
>  arch/arm/mach-imx/gpc.c        | 1 +
>  arch/arm/mach-imx/platsmp.c    | 1 +
>  arch/arm/mach-imx/pm-imx6.c    | 2 ++
>  arch/arm/mach-imx/pm-imx7ulp.c | 1 +
>  5 files changed, 8 insertions(+)
> 
> diff --git a/arch/arm/mach-imx/anatop.c b/arch/arm/mach-imx/anatop.c
> index 8fb68c0..5985731 100644
> --- a/arch/arm/mach-imx/anatop.c
> +++ b/arch/arm/mach-imx/anatop.c
> @@ -135,6 +135,7 @@ void __init imx_init_revision_from_anatop(void)
>  			void __iomem *src_base;
>  			u32 sbmr2;
>  
> +			of_node_put(np);
>  			np = of_find_compatible_node(NULL, NULL,
>  						     "fsl,imx6ul-src");
>  			src_base = of_iomap(np, 0);
> @@ -152,6 +153,8 @@ void __init imx_init_revision_from_anatop(void)
>  
>  	mxc_set_cpu_type(digprog >> 16 & 0xff);
>  	imx_set_soc_revision(revision);
> +
> +	of_node_put(np);
>  }

It would be a bit more natural here IMHO to introduce a second struct
device_node * variable for the fsl,imx6ul-src device. Then each
of_node_put would belong to exactly one of_find_compatible_node().
(Now the of_node_put() in line 157 frees the fsl,imx6ul-src on i.MX6ULL
and fsl,imx6q-anatop on the others.)

The other hunks look fine.

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ