kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Stephen Boyd <sboyd@kernel.org>
Cc: Christophe JAILLET <christophe.jaillet@wanadoo.fr>,
	Julia.Lawall@inria.fr, gregory.clement@bootlin.com,
	lee.jones@linaro.org, mturquette@baylibre.com,
	linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org,
	kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] clk: mvebu: ap-cpu-clk: Fix a memory leak in error handling paths
Date: Mon, 30 Aug 2021 14:59:31 +0300	[thread overview]
Message-ID: <20210830115931.GH12231@kadam> (raw)
In-Reply-To: <163021483704.2676726.2051426762011017819@swboyd.mtv.corp.google.com>

On Sat, Aug 28, 2021 at 10:27:17PM -0700, Stephen Boyd wrote:
> Quoting Christophe JAILLET (2021-04-23 00:02:26)
> > If we exit the for_each_of_cpu_node loop early, the reference on the
> > current node must be decremented, otherwise there is a leak.
> > 
> > Fixes: f756e362d938 ("clk: mvebu: add CPU clock driver for Armada 7K/8K")
> > Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> > ---
> > Also, I wonder if the drivers in drivers/clk/mvebu are used by anyone.
> > In order to compile-test the changes, I also had to change the 'bool' in Kconfig
> > by 'bool "blah"'. Without this change, it was not possible to set
> > CONFIG_ARMADA_AP_CPU_CLK required by Makefile.
> > 
> > I don't know if I did something wrong, if it is an issue only on my environment
> > or if something got broken at some time in the build chain but it looks
> > spurious.
> > 
> > If I'm right and that these drivers never compile and no-one noticed it,
> > maybe removing them is better than fixing some unlikely issues and style.
> > If these drivers should stay, Kconfig may need some love from someone.
> 
> Nobody has said anything on this patch. So I'm not really sure what's
> going on. Probably we never take the error path, or the whole system
> fails to boot?

You probably take this one.

   106                  /* If cpu2 or cpu3 is enabled */
   107                  if (cpu & APN806_CLUSTER_NUM_MASK) {
   108                          nclusters = 2;
   109  +                       of_node_put(dn);
   110                          break;
   111                  }

But, yeah, probably on one carse of "dn" can't be freed in real life.

Still probably worth fixing though just for correctness.  Otherwise it
makes static analysis less effective if people deliberately leave bugs
in the code.

regards,
dan carpenter

  reply	other threads:[~2021-08-30 12:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-23  7:02 Christophe JAILLET
2021-08-29  5:27 ` Stephen Boyd
2021-08-30 11:59   ` Dan Carpenter [this message]
2021-09-01  5:29     ` Stephen Boyd
2021-09-01  9:57 ` Dan Carpenter
2021-09-15  1:25 ` Stephen Boyd

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=20210830115931.GH12231@kadam \
    --to=dan.carpenter@oracle.com \
    --cc=Julia.Lawall@inria.fr \
    --cc=christophe.jaillet@wanadoo.fr \
    --cc=gregory.clement@bootlin.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=lee.jones@linaro.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mturquette@baylibre.com \
    --cc=sboyd@kernel.org \
    --subject='Re: [PATCH] clk: mvebu: ap-cpu-clk: Fix a memory leak in error handling paths' \
    /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

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