linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
To: Dan Carpenter <dan.carpenter@linaro.org>
Cc: andy.shevchenko@gmail.com, "Wells Lu 呂芳騰" <wells.lu@sunplus.com>,
	"Wells Lu" <wellslutw@gmail.com>,
	"linus.walleij@linaro.org" <linus.walleij@linaro.org>,
	"linux-gpio@vger.kernel.org" <linux-gpio@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] pinctrl:sunplus: Add check for kmalloc
Date: Thu, 25 May 2023 22:00:34 +0200	[thread overview]
Message-ID: <381c7339-685c-8973-ecf2-5a34cd18cda3@wanadoo.fr> (raw)
In-Reply-To: <9f937bde-c908-4941-b65c-e4c303d3acae@kili.mountain>

Le 25/05/2023 à 21:19, Dan Carpenter a écrit :
> On Tue, May 23, 2023 at 10:05:49PM +0200, Christophe JAILLET wrote:
>> Should be looked at more carefully, but
>>    dt_to_map_one_config		(in /drivers/pinctrl/devicetree.c)
>>      .dt_node_to_map
>>        --> sppctl_dt_node_to_map
>>
>> Should dt_to_map_one_config() fail, pinctrl_dt_free_maps() is called
>> (see https://elixir.bootlin.com/linux/v6.4-rc1/source/drivers/pinctrl/devicetree.c#L281)
> 
> Thanks for this call tree, I don't have this file enabled in my build
> so it's not easy for me to find how sppctl_dt_node_to_map() was called.
> 
> drivers/pinctrl/devicetree.c
>     160                  dev_err(p->dev, "pctldev %s doesn't support DT\n",
>     161                          dev_name(pctldev->dev));
>     162                  return -ENODEV;
>     163          }
>     164          ret = ops->dt_node_to_map(pctldev, np_config, &map, &num_maps);
>                                                                ^^^^
> "map" isn't stored anywhere so it will be leaked.  I guess kmemleak
> already figured this out.
> 
>     165          if (ret < 0)
>     166                  return ret;
>     167          else if (num_maps == 0) {
>     168                  /*
> 

Hi, thanks Dan for sharing your PoV on this.

CJ


      reply	other threads:[~2023-05-25 20:00 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-23 10:11 [PATCH] pinctrl:sunplus: Add check for kmalloc Wells Lu
2023-05-23 16:42 ` andy.shevchenko
2023-05-23 17:39   ` Wells Lu 呂芳騰
2023-05-23 19:37     ` andy.shevchenko
2023-05-23 20:05       ` Christophe JAILLET
2023-05-25  3:22         ` Wells Lu 呂芳騰
2023-05-25 18:37           ` Christophe JAILLET
2023-05-25 19:42             ` Dan Carpenter
2023-05-26  2:04             ` Wells Lu 呂芳騰
2023-05-26  5:19               ` Christophe JAILLET
2023-05-25 19:19         ` Dan Carpenter
2023-05-25 20:00           ` Christophe JAILLET [this message]

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=381c7339-685c-8973-ecf2-5a34cd18cda3@wanadoo.fr \
    --to=christophe.jaillet@wanadoo.fr \
    --cc=andy.shevchenko@gmail.com \
    --cc=dan.carpenter@linaro.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=wells.lu@sunplus.com \
    --cc=wellslutw@gmail.com \
    /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).