lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <e9992ba9-bf5b-4533-948a-e19778bb6f50@collabora.com>
Date: Mon, 29 Sep 2025 12:47:26 +0200
From: AngeloGioacchino Del Regno <angelogioacchino.delregno@...labora.com>
To: Haotian Zhang <vulab@...as.ac.cn>,
 Matthias Brugger <matthias.bgg@...il.com>
Cc: linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
 linux-mediatek@...ts.infradead.org
Subject: Re: [PATCH] clk: mediatek: Use devm_alloc for clk_data allocation to
 fix memory leak on probe error

Il 29/09/25 04:36, Haotian Zhang ha scritto:
> The probe functions for the mt6765 apmixed, top, and infrasys clocks
> use mtk_alloc_clk_data() to allocate memory. This requires manual
> freeing of the memory in all error handling paths and in the driver's
> remove function.
> 
> Switch to mtk_devm_alloc_clk_data() in order to fix the memory leak in the
> probe function.
> 
> Fixes: 1aca9939bf72 ("clk: mediatek: Add MT6765 clock support")
> Signed-off-by: Haotian Zhang <vulab@...as.ac.cn>

You have to resend this to the correct recipients, and you have to fix the
commit title; something like

clk: mediatek: mt6765: Switch to mtk_devm_alloc_clk_data to fix memleak

For the code:

Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregnoòcollabora.com>

> ---
>   drivers/clk/mediatek/clk-mt6765.c | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/clk/mediatek/clk-mt6765.c b/drivers/clk/mediatek/clk-mt6765.c
> index d53731e7933f..5cfb9a3a5ee3 100644
> --- a/drivers/clk/mediatek/clk-mt6765.c
> +++ b/drivers/clk/mediatek/clk-mt6765.c
> @@ -736,7 +736,7 @@ static int clk_mt6765_apmixed_probe(struct platform_device *pdev)
>   	if (IS_ERR(base))
>   		return PTR_ERR(base);
>   
> -	clk_data = mtk_alloc_clk_data(CLK_APMIXED_NR_CLK);
> +	clk_data = mtk_devm_alloc_clk_data(CLK_APMIXED_NR_CLK);
>   	if (!clk_data)
>   		return -ENOMEM;
>   
> @@ -770,7 +770,7 @@ static int clk_mt6765_top_probe(struct platform_device *pdev)
>   	if (IS_ERR(base))
>   		return PTR_ERR(base);
>   
> -	clk_data = mtk_alloc_clk_data(CLK_TOP_NR_CLK);
> +	clk_data = mtk_devm_alloc_clk_data(CLK_TOP_NR_CLK);
>   	if (!clk_data)
>   		return -ENOMEM;
>   
> @@ -810,7 +810,7 @@ static int clk_mt6765_ifr_probe(struct platform_device *pdev)
>   	if (IS_ERR(base))
>   		return PTR_ERR(base);
>   
> -	clk_data = mtk_alloc_clk_data(CLK_IFR_NR_CLK);
> +	clk_data = mtk_devm_alloc_clk_data(CLK_IFR_NR_CLK);
>   	if (!clk_data)
>   		return -ENOMEM;
>   



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ