From: Brian Masney <bmasney@redhat.com>
To: "Alexander A. Klimov" <grandmaster@al2klimov.de>
Cc: Peter De Schrijver <pdeschrijver@nvidia.com>,
Prashant Gaikwad <pgaikwad@nvidia.com>,
Michael Turquette <mturquette@baylibre.com>,
Stephen Boyd <sboyd@kernel.org>,
Thierry Reding <thierry.reding@kernel.org>,
Jonathan Hunter <jonathanh@nvidia.com>,
Dmitry Osipenko <digetx@gmail.com>,
"open list:COMMON CLK FRAMEWORK" <linux-clk@vger.kernel.org>,
"open list:TEGRA ARCHITECTURE SUPPORT"
<linux-tegra@vger.kernel.org>,
open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] clk: tegra: tegra124-emc: fix krealloc() memory leak
Date: Tue, 26 May 2026 13:33:22 -0400 [thread overview]
Message-ID: <ahXZYtZM3KrF3hgn@redhat.com> (raw)
In-Reply-To: <20260526061321.6123-2-grandmaster@al2klimov.de>
On Tue, May 26, 2026 at 08:13:13AM +0200, Alexander A. Klimov wrote:
> Don't just overwrite the original pointer passed to krealloc()
> with its return value without checking latter:
>
> MEM = krealloc(MEM, SZ, GFP);
>
> If krealloc() returns NULL, that erases the pointer
> to the still allocated memory, hence leaks this memory.
> Instead, use a temporary variable, check it's not NULL
> and only then assign it to the original pointer:
>
> TMP = krealloc(MEM, SZ, GFP);
> if (!TMP) return;
> MEM = TMP;
>
> Fixes: 888ca40e2843 ("clk: tegra: emc: Support multiple RAM codes")
> Signed-off-by: Alexander A. Klimov <grandmaster@al2klimov.de>
Reviewed-by: Brian Masney <bmasney@redhat.com>
next prev parent reply other threads:[~2026-05-26 17:33 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-26 6:13 [PATCH] clk: samsung: exynos5410: fix refcount leak Alexander A. Klimov
2026-05-26 6:13 ` [PATCH] clk: tegra: tegra124-emc: fix krealloc() memory leak Alexander A. Klimov
2026-05-26 17:33 ` Brian Masney [this message]
2026-05-28 20:30 ` Thierry Reding
2026-05-31 19:52 ` [PATCH v2] " Alexander A. Klimov
2026-05-26 6:13 ` [PATCH] dmaengine: ioatdma: use !kstrtoint(), not sscanf()!=-1 Alexander A. Klimov
2026-05-26 6:24 ` sashiko-bot
2026-05-26 14:49 ` Dave Jiang
2026-05-26 18:06 ` Alexander A. Klimov
2026-05-28 20:06 ` Dave Jiang
2026-05-31 8:56 ` Alexander A. Klimov
2026-06-01 15:12 ` Dave Jiang
2026-05-26 6:13 ` [PATCH] tlclk: if sscanf() fails, fall back to 0, not random value Alexander A. Klimov
2026-05-26 17:29 ` [PATCH] clk: samsung: exynos5410: fix refcount leak Brian Masney
2026-05-28 1:15 ` Alexey Klimov
2026-05-28 8:02 ` Peter Griffin
2026-05-30 16:26 ` Krzysztof Kozlowski
2026-05-31 9:27 ` Alexander A. Klimov
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=ahXZYtZM3KrF3hgn@redhat.com \
--to=bmasney@redhat.com \
--cc=digetx@gmail.com \
--cc=grandmaster@al2klimov.de \
--cc=jonathanh@nvidia.com \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=mturquette@baylibre.com \
--cc=pdeschrijver@nvidia.com \
--cc=pgaikwad@nvidia.com \
--cc=sboyd@kernel.org \
--cc=thierry.reding@kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.