* [PATCH] openrisc: Fix a memory leak
@ 2021-04-23 15:09 Christophe JAILLET
2021-04-23 21:19 ` Stafford Horne
0 siblings, 1 reply; 2+ messages in thread
From: Christophe JAILLET @ 2021-04-23 15:09 UTC (permalink / raw)
To: jonas, stefan.kristiansson, shorne, rppt, akpm, arnd
Cc: openrisc, linux-kernel, kernel-janitors, Christophe JAILLET
'setup_find_cpu_node()' take a reference on the node it returns.
This reference must be decremented when not needed anymore, or there will
be a leak.
Add the missing 'of_node_put(cpu)'.
Note that 'setup_cpuinfo()' that also calls this function already has a
correct 'of_node_put(cpu)' at its end.
Fixes: 9d02a4283e9c ("OpenRISC: Boot code")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
arch/openrisc/kernel/setup.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/openrisc/kernel/setup.c b/arch/openrisc/kernel/setup.c
index 2416a9f91533..c6f9e7b9f7cb 100644
--- a/arch/openrisc/kernel/setup.c
+++ b/arch/openrisc/kernel/setup.c
@@ -278,6 +278,8 @@ void calibrate_delay(void)
pr_cont("%lu.%02lu BogoMIPS (lpj=%lu)\n",
loops_per_jiffy / (500000 / HZ),
(loops_per_jiffy / (5000 / HZ)) % 100, loops_per_jiffy);
+
+ of_node_put(cpu);
}
void __init setup_arch(char **cmdline_p)
--
2.27.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] openrisc: Fix a memory leak
2021-04-23 15:09 [PATCH] openrisc: Fix a memory leak Christophe JAILLET
@ 2021-04-23 21:19 ` Stafford Horne
0 siblings, 0 replies; 2+ messages in thread
From: Stafford Horne @ 2021-04-23 21:19 UTC (permalink / raw)
To: Christophe JAILLET
Cc: jonas, stefan.kristiansson, rppt, akpm, arnd, openrisc,
linux-kernel, kernel-janitors
On Fri, Apr 23, 2021 at 05:09:28PM +0200, Christophe JAILLET wrote:
> 'setup_find_cpu_node()' take a reference on the node it returns.
> This reference must be decremented when not needed anymore, or there will
> be a leak.
>
> Add the missing 'of_node_put(cpu)'.
>
> Note that 'setup_cpuinfo()' that also calls this function already has a
> correct 'of_node_put(cpu)' at its end.
Thanks, this looks good to me. I will queue it up.
> Fixes: 9d02a4283e9c ("OpenRISC: Boot code")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> arch/openrisc/kernel/setup.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/arch/openrisc/kernel/setup.c b/arch/openrisc/kernel/setup.c
> index 2416a9f91533..c6f9e7b9f7cb 100644
> --- a/arch/openrisc/kernel/setup.c
> +++ b/arch/openrisc/kernel/setup.c
> @@ -278,6 +278,8 @@ void calibrate_delay(void)
> pr_cont("%lu.%02lu BogoMIPS (lpj=%lu)\n",
> loops_per_jiffy / (500000 / HZ),
> (loops_per_jiffy / (5000 / HZ)) % 100, loops_per_jiffy);
> +
> + of_node_put(cpu);
> }
>
> void __init setup_arch(char **cmdline_p)
> --
> 2.27.0
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-04-23 21:19 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-23 15:09 [PATCH] openrisc: Fix a memory leak Christophe JAILLET
2021-04-23 21:19 ` Stafford Horne
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).