linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] powerpc/sysdev/of_rtc: Fix possible memory leak in of_instantiate_rtc
@ 2021-11-03  1:47 He Ying
  2021-12-27  3:33 ` He Ying
  0 siblings, 1 reply; 2+ messages in thread
From: He Ying @ 2021-11-03  1:47 UTC (permalink / raw)
  To: mpe, benh, paulus; +Cc: linuxppc-dev, linux-kernel

If of_address_to_resource() in of_instantiate_rtc() fails, previously
allocated memory res is not freed. Add missing kfree() for it.

Signed-off-by: He Ying <heying24@huawei.com>
---
 arch/powerpc/sysdev/of_rtc.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/powerpc/sysdev/of_rtc.c b/arch/powerpc/sysdev/of_rtc.c
index 1f408d34a6a7..23b896996c2f 100644
--- a/arch/powerpc/sysdev/of_rtc.c
+++ b/arch/powerpc/sysdev/of_rtc.c
@@ -44,6 +44,7 @@ void __init of_instantiate_rtc(void)
 				printk(KERN_ERR "OF RTC: Error "
 				       "translating resources for %pOF\n",
 				       node);
+				kfree(res);
 				continue;
 			}
 
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-12-27  3:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-03  1:47 [PATCH] powerpc/sysdev/of_rtc: Fix possible memory leak in of_instantiate_rtc He Ying
2021-12-27  3:33 ` He Ying

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).