mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Wang, Xiaolei" <Xiaolei.Wang@windriver.com>
To: Markus Elfring <Markus.Elfring@web.de>,
	"kernel-janitors@vger.kernel.org"
	<kernel-janitors@vger.kernel.org>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Mark Brown <broonie@kernel.org>,
	"Rafael J. Wysocki" <rafael@kernel.org>
Subject: RE: [PATCH] regmap: debugfs: fix a memory leak when calling regmap_attach_dev
Date: Sun, 27 Dec 2020 12:18:16 +0000	[thread overview]
Message-ID: <PH0PR11MB507734E4DF73DF015AD601EB95DA0@PH0PR11MB5077.namprd11.prod.outlook.com> (raw)
In-Reply-To: <737e8b89-5748-2ef5-5294-8e65421931b9@web.de>

Hi Markus

> This should be caused by
> commit <9b947a13e7f6> ("<regmap: use debugfs even when no device>")

> I suggest to omit angle brackets from such information.


> * Will another imperative wording become helpful for the commit description?

> * How do you think about to add the tag “Fixes”?

Do you mean so?

commit:
         9b947a13e7f6 ("regmap: use debugfs even when no device")

…
> +++ b/drivers/base/regmap/regmap-debugfs.c
…
> @@ -582,8 +582,10 @@ void regmap_debugfs_init(struct regmap *map)
>  		devname = dev_name(map->dev);
>
>  	if (name) {
> -		map->debugfs_name = kasprintf(GFP_KERNEL, "%s-%s",
> +		if (!map->debugfs_name) {
> +			map->debugfs_name = kasprintf(GFP_KERNEL, "%s-%s",
>  					      devname, name);
> +		}
…

> I propose to add another null pointer check together with corresponding exception handling.

Which one do you mean by "another null point"? Do you mean that if the call "regmap_debugfs_init" function is repeated, it returns directly?

Regards,
Xiaolei



-----Original Message-----
From: Markus Elfring <Markus.Elfring@web.de> 
Sent: Saturday, December 26, 2020 10:16 PM
To: Wang, Xiaolei <Xiaolei.Wang@windriver.com>; kernel-janitors@vger.kernel.org
Cc: linux-kernel@vger.kernel.org; Greg Kroah-Hartman <gregkh@linuxfoundation.org>; Mark Brown <broonie@kernel.org>; Rafael J. Wysocki <rafael@kernel.org>
Subject: Re: [PATCH] regmap: debugfs: fix a memory leak when calling regmap_attach_dev

> This should be caused by
> commit <9b947a13e7f6> ("<regmap: use debugfs even when no device>")

I suggest to omit angle brackets from such information.


* Will another imperative wording become helpful for the commit description?

* How do you think about to add the tag “Fixes”?


…
> +++ b/drivers/base/regmap/regmap-debugfs.c
…
> @@ -582,8 +582,10 @@ void regmap_debugfs_init(struct regmap *map)
>  		devname = dev_name(map->dev);
>
>  	if (name) {
> -		map->debugfs_name = kasprintf(GFP_KERNEL, "%s-%s",
> +		if (!map->debugfs_name) {
> +			map->debugfs_name = kasprintf(GFP_KERNEL, "%s-%s",
>  					      devname, name);
> +		}
…

I propose to add another null pointer check together with corresponding exception handling.

Regards,
Markus

  parent reply	other threads:[~2020-12-27 12:20 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-25 12:26 Xiaolei Wang
     [not found] ` <737e8b89-5748-2ef5-5294-8e65421931b9@web.de>
2020-12-27 12:18   ` Wang, Xiaolei [this message]
     [not found]     ` <46e289a6-49ab-a627-dab1-56a8b0587c08@web.de>
2020-12-28  2:26       ` Wang, Xiaolei

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=PH0PR11MB507734E4DF73DF015AD601EB95DA0@PH0PR11MB5077.namprd11.prod.outlook.com \
    --to=xiaolei.wang@windriver.com \
    --cc=Markus.Elfring@web.de \
    --cc=broonie@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rafael@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®