[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <470c192a-8170-6ea9-eb14-aa678555a789@hust.edu.cn>
Date: Sat, 15 Apr 2023 09:55:47 +0800
From: Dongliang Mu <dzm91@...t.edu.cn>
To: Dan Carpenter <error27@...il.com>, Stephen Boyd <sboyd@...nel.org>
Cc: Abel Vesa <abelvesa@...nel.org>, Bai Ping <ping.bai@....com>,
Fabio Estevam <festevam@...il.com>,
Michael Turquette <mturquette@...libre.com>,
NXP Linux Team <linux-imx@....com>,
Peng Fan <peng.fan@....com>,
Pengutronix Kernel Team <kernel@...gutronix.de>,
Sascha Hauer <s.hauer@...gutronix.de>,
Shawn Guo <shawnguo@...nel.org>,
Zhou Shide <u201911681@...t.edu.cn>,
hust-os-kernel-patches@...glegroups.com, linux-clk@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
Hao Luo <m202171776@...t.edu.cn>
Subject: Re: [PATCH] clk: imx: clk-imx8mm: fix memory leak issue in
'imx8mm_clocks_probe'
On 2023/4/15 00:38, Dan Carpenter wrote:
> On Thu, Apr 13, 2023 at 12:06:59PM -0700, Stephen Boyd wrote:
>> Quoting Zhou Shide (2023-04-12 20:24:39)
>>> The function imx8mm_clocks_probe() has two main issues:
>>> - The of_iomap() function may cause a memory leak.
>>> - Memory allocated for 'clk_hw_data' may not be freed properly
>>> in some paths.
>>>
>>> To fix these issues, this commit replaces the use of of_iomap()
>>> with devm_of_iomap() and replaces kzalloc() with devm_kzalloc().
>>> This ensures that all memory is properly managed and automatically
>>> freed when the device is removed.
>>>
>>> In addition, when devm_of_iomap() allocates memory with an error,
>>> it will first jump to label "unregister_hws" and
>>> then return PTR_ ERR(base).
>>>
>>> Fixes: 9c71f9ea35d7 ("clk: imx: imx8mm: Switch to clk_hw based API")
>>> Fixes: ba5625c3e272 ("clk: imx: Add clock driver support for imx8mm")
>>> Signed-off-by: Zhou Shide <u201911681@...t.edu.cn>
>>> ---
>>> The issue is discovered by static analysis, and the patch is not tested yet.
>> And you're not coordinating with each other?
>>
> This is a university program. The patches are reviewed by his professor
> and teaching assistants etc. I've been reviewing some of these patches
> as well because of they're using Smatch.
Thanks for your explanation, Dan. We are from Huazhong University of
Science and Technology.
Some undergraduate and graduatestudents who are interested in Linux
Kernel are guided by me [1] and Dan to contribute into our kernel community.
We found Smatch is really great in finding kernel issues and these
issues are suitable for undergraduate students. Therefore, I contacted
Dan to do a favor for patch interview. And our internal review are
publicly hosted in a google group [2].
Please let me know if you have any questions.
[1] https://mudongliang.github.io/about/
[2] https://groups.google.com/g/hust-os-kernel-patches
>
> regards,
> dan carpenter
>
Powered by blists - more mailing lists