From: He Ying <heying24@huawei.com>
To: <mpe@ellerman.id.au>, <benh@kernel.crashing.org>, <paulus@samba.org>
Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org
Subject: [PATCH] powerpc/sysdev/of_rtc: Fix possible memory leak in of_instantiate_rtc
Date: Tue, 2 Nov 2021 21:47:17 -0400 [thread overview]
Message-ID: <20211103014717.162886-1-heying24@huawei.com> (raw)
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
next reply other threads:[~2021-11-03 1:46 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-03 1:47 He Ying [this message]
2021-12-27 3:33 ` [PATCH] powerpc/sysdev/of_rtc: Fix possible memory leak in of_instantiate_rtc He Ying
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211103014717.162886-1-heying24@huawei.com \
--to=heying24@huawei.com \
--cc=benh@kernel.crashing.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mpe@ellerman.id.au \
--cc=paulus@samba.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).