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, 16 Jun 2022 11:36:05 +0530
From:   Viresh Kumar <viresh.kumar@...aro.org>
To:     Liang He <windhl@....com>
Cc:     vireshk@...nel.org, shiraz.linux.kernel@...il.com, soc@...nel.org,
        linux@...linux.org.uk, linux-arm-kernel@...ts.infradead.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] arch: arm: mach-spear: Add missing of_node_put() in
 time.c

On 15-06-22, 20:39, Liang He wrote:
> In spear_setup_of_timer(), of_find_matching_node() will return a
> node pointer with refcount incrementd. We should use of_node_put()
> in each fail path or when it is not used anymore.
> 
> Signed-off-by: Liang He <windhl@....com>
> ---
>  arch/arm/mach-spear/time.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/arm/mach-spear/time.c b/arch/arm/mach-spear/time.c
> index d1fdb6066f7b..a1b6635b4ecb 100644
> --- a/arch/arm/mach-spear/time.c
> +++ b/arch/arm/mach-spear/time.c
> @@ -217,16 +217,20 @@ void __init spear_setup_of_timer(void)
>  
>  	irq = irq_of_parse_and_map(np, 0);
>  	if (!irq) {
> +		of_node_put(np);
>  		pr_err("%s: No irq passed for timer via DT\n", __func__);
>  		return;
>  	}
>  
>  	gpt_base = of_iomap(np, 0);
>  	if (!gpt_base) {
> +		of_node_put(np);
>  		pr_err("%s: of iomap failed\n", __func__);
>  		return;
>  	}
> -
> +	
> +	of_node_put(np);
> +	
>  	gpt_clk = clk_get_sys("gpt0", NULL);
>  	if (IS_ERR(gpt_clk)) {
>  		pr_err("%s:couldn't get clk for gpt\n", __func__);

Since this routine already have error labels, for consistence it would be better
to add another one "err_put_np" and use goto to that ?

-- 
viresh

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ