linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1] clk: tegra: Fix double-free in tegra_clk_init()
@ 2019-12-10  2:05 Dmitry Osipenko
  2019-12-10 12:22 ` Thierry Reding
  2019-12-24  8:01 ` Stephen Boyd
  0 siblings, 2 replies; 3+ messages in thread
From: Dmitry Osipenko @ 2019-12-10  2:05 UTC (permalink / raw)
  To: Thierry Reding, Jonathan Hunter, Peter De Schrijver,
	Prashant Gaikwad, Sowjanya Komatineni, Michael Turquette,
	Stephen Boyd
  Cc: linux-tegra, linux-clk, linux-kernel

It's unlikely to happen in practice ever, but makes static checkers happy.

Fixes: 535f296d47de ("clk: tegra: Add suspend and resume support on Tegra210")
Reported-by: Stephen Boyd <sboyd@kernel.org>
Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
---
 drivers/clk/tegra/clk.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/tegra/clk.c b/drivers/clk/tegra/clk.c
index e6bd6d1ea012..f6cdce441cf7 100644
--- a/drivers/clk/tegra/clk.c
+++ b/drivers/clk/tegra/clk.c
@@ -231,8 +231,10 @@ struct clk ** __init tegra_clk_init(void __iomem *regs, int num, int banks)
 	periph_banks = banks;
 
 	clks = kcalloc(num, sizeof(struct clk *), GFP_KERNEL);
-	if (!clks)
+	if (!clks) {
 		kfree(periph_clk_enb_refcnt);
+		return NULL;
+	}
 
 	clk_num = num;
 
-- 
2.24.0


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

* Re: [PATCH v1] clk: tegra: Fix double-free in tegra_clk_init()
  2019-12-10  2:05 [PATCH v1] clk: tegra: Fix double-free in tegra_clk_init() Dmitry Osipenko
@ 2019-12-10 12:22 ` Thierry Reding
  2019-12-24  8:01 ` Stephen Boyd
  1 sibling, 0 replies; 3+ messages in thread
From: Thierry Reding @ 2019-12-10 12:22 UTC (permalink / raw)
  To: Dmitry Osipenko
  Cc: Jonathan Hunter, Peter De Schrijver, Prashant Gaikwad,
	Sowjanya Komatineni, Michael Turquette, Stephen Boyd,
	linux-tegra, linux-clk, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 490 bytes --]

On Tue, Dec 10, 2019 at 05:05:12AM +0300, Dmitry Osipenko wrote:
> It's unlikely to happen in practice ever, but makes static checkers happy.
> 
> Fixes: 535f296d47de ("clk: tegra: Add suspend and resume support on Tegra210")
> Reported-by: Stephen Boyd <sboyd@kernel.org>
> Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
> ---
>  drivers/clk/tegra/clk.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)

Good catch:

Acked-by: Thierry Reding <treding@nvidia.com>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH v1] clk: tegra: Fix double-free in tegra_clk_init()
  2019-12-10  2:05 [PATCH v1] clk: tegra: Fix double-free in tegra_clk_init() Dmitry Osipenko
  2019-12-10 12:22 ` Thierry Reding
@ 2019-12-24  8:01 ` Stephen Boyd
  1 sibling, 0 replies; 3+ messages in thread
From: Stephen Boyd @ 2019-12-24  8:01 UTC (permalink / raw)
  To: Dmitry Osipenko, Jonathan Hunter, Michael Turquette,
	Peter De Schrijver, Prashant Gaikwad, Sowjanya Komatineni,
	Thierry Reding
  Cc: linux-tegra, linux-clk, linux-kernel

Quoting Dmitry Osipenko (2019-12-09 18:05:12)
> It's unlikely to happen in practice ever, but makes static checkers happy.
> 
> Fixes: 535f296d47de ("clk: tegra: Add suspend and resume support on Tegra210")
> Reported-by: Stephen Boyd <sboyd@kernel.org>
> Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
> ---

Applied to clk-fixes


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

end of thread, other threads:[~2019-12-24  8:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-10  2:05 [PATCH v1] clk: tegra: Fix double-free in tegra_clk_init() Dmitry Osipenko
2019-12-10 12:22 ` Thierry Reding
2019-12-24  8:01 ` Stephen Boyd

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