[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <835b17e1-0e64-4e00-ba4d-ad8608b5e61f@kernel.org>
Date: Tue, 1 Oct 2024 21:48:29 +0200
From: Krzysztof Kozlowski <krzk@...nel.org>
To: Gax-c <zichenxie0106@...il.com>, myungjoo.ham@...sung.com,
cw00.choi@...sung.com, stanley_chang@...ltek.com
Cc: linux-kernel@...r.kernel.org, Zijie Zhao <zzjas98@...il.com>,
Chenyuan Yang <chenyuan0y@...il.com>
Subject: Re: [PATCH] Fix possible NULL Pointer Dereference in
'extcon_rtk_type_c_probe'
On 30/09/2024 00:38, Gax-c wrote:
> A 'devm_kzalloc' in 'extcon_rtk_type_c_probe' could possibly return null pointer.
> Add a null check for the returned pointer.
>
> Fixes: 8a590d7371f0 ("extcon: add Realtek DHC RTD SoC Type-C driver")
> Signed-off-by: Zichen Xie <zichenxie0106@...il.com>
> Reported-by: Zichen Xie <zichenxie0106@...il.com>
> Reported-by: Zijie Zhao <zzjas98@...il.com>
> Reported-by: Chenyuan Yang <chenyuan0y@...il.com>
All previous comments apply.
> ---
> drivers/extcon/extcon-rtk-type-c.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/drivers/extcon/extcon-rtk-type-c.c b/drivers/extcon/extcon-rtk-type-c.c
> index a592bab77538..9a0824fc7cbe 100644
> --- a/drivers/extcon/extcon-rtk-type-c.c
> +++ b/drivers/extcon/extcon-rtk-type-c.c
> @@ -1371,6 +1371,12 @@ static int extcon_rtk_type_c_probe(struct platform_device *pdev)
>
> type_c->type_c_cfg = devm_kzalloc(dev, sizeof(*type_c_cfg), GFP_KERNEL);
>
Same as in other patches - drop blank line.
> + if (!type_c->type_c_cfg) {
> + dev_err(dev, "Failed to allocate memory for type_c_cfg!\n");
No, drop.
> + ret = -ENOMEM;
> + goto err;
Best regards,
Krzysztof
Powered by blists - more mailing lists