[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <PH0PR11MB5077EC74C0A81ABF8F082BC795D70@PH0PR11MB5077.namprd11.prod.outlook.com>
Date: Wed, 30 Dec 2020 10:14:22 +0000
From: "Wang, Xiaolei" <Xiaolei.Wang@...driver.com>
To: Markus Elfring <Markus.Elfring@....de>,
"kernel-janitors@...r.kernel.org" <kernel-janitors@...r.kernel.org>
CC: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
David Lechner <david@...hnology.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Mark Brown <broonie@...nel.org>,
"Rafael J. Wysocki" <rafael@...nel.org>,
Julia Lawall <julia.lawall@...6.fr>
Subject: RE: [PATCH v3] regmap: debugfs: Fix a memory leak when calling
regmap_attach_dev
Hi Markus
Thank you very much, very good suggestion, do I need to re-send a patch to fix this problem, or modify the previous patch and send it again?
Thanks
Xiaolei
…
> +++ b/drivers/base/regmap/regmap-debugfs.c
> @@ -582,18 +582,25 @@ void regmap_debugfs_init(struct regmap *map)
…
> + map->debugfs_name = kasprintf(GFP_KERNEL, "%s-%s",
> devname, name);
> I suggest to reconsider the alignment for function call parameters for this patch.
…
> + if (!map->debugfs_name)
> + kfree(map->debugfs_name);
> Such a null pointer check is redundant.
> See also:
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/scripts/coccinelle/free/ifnullfree.cocci?id=139711f033f636cc78b6aaf7363252241b9698ef#n2
-----Original Message-----
From: Markus Elfring <Markus.Elfring@....de>
Sent: Wednesday, December 30, 2020 5:49 PM
To: Wang, Xiaolei <Xiaolei.Wang@...driver.com>; kernel-janitors@...r.kernel.org
Cc: linux-kernel@...r.kernel.org; David Lechner <david@...hnology.com>; Greg Kroah-Hartman <gregkh@...uxfoundation.org>; Mark Brown <broonie@...nel.org>; Rafael J. Wysocki <rafael@...nel.org>; Julia Lawall <julia.lawall@...6.fr>
Subject: Re: [PATCH v3] regmap: debugfs: Fix a memory leak when calling regmap_attach_dev
…
> +++ b/drivers/base/regmap/regmap-debugfs.c
> @@ -582,18 +582,25 @@ void regmap_debugfs_init(struct regmap *map)
…
> + map->debugfs_name = kasprintf(GFP_KERNEL, "%s-%s",
> devname, name);
I suggest to reconsider the alignment for function call parameters for this patch.
…
> + if (!map->debugfs_name)
> + kfree(map->debugfs_name);
Such a null pointer check is redundant.
See also:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/scripts/coccinelle/free/ifnullfree.cocci?id=139711f033f636cc78b6aaf7363252241b9698ef#n2
Regards,
Markus
Powered by blists - more mailing lists