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] [thread-next>] [day] [month] [year] [list]
Message-ID: <32290fec-72e7-44fc-a187-d29347ea94ea@kernel.org>
Date: Fri, 16 May 2025 14:32:49 +0200
From: Krzysztof Kozlowski <krzk@...nel.org>
To: Charles Han <hanchunchao@...pur.com>, sre@...nel.org,
 akpm@...ux-foundation.org, lee@...nel.org
Cc: linux-pm@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] charger: max14577: Handle NULL pdata when CONFIG_OF is
 not set

On 16/05/2025 11:53, Charles Han wrote:
> When the kernel is not configured  CONFIG_OF, the max14577_charger_dt_init
> function returns NULL. Fix the max14577_charger_probe functionby returning
>  -ENODATA instead of potentially passing a NULL pointer to PTR_ERR.
> 
> Fix below smatch warning.
> smatch warnings:
> drivers/power/supply/max14577_charger.c:576 max14577_charger_probe() warn: passing zero to 'PTR_ERR'
> 
> Fixes: e30110e9c96f ("charger: max14577: Configure battery-dependent settings from DTS and sysfs")
> Signed-off-by: Charles Han <hanchunchao@...pur.com>
> ---
>  drivers/power/supply/max14577_charger.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/power/supply/max14577_charger.c b/drivers/power/supply/max14577_charger.c
> index 1cef2f860b5f..ed6f5a584c2c 100644
> --- a/drivers/power/supply/max14577_charger.c
> +++ b/drivers/power/supply/max14577_charger.c
> @@ -572,8 +572,10 @@ static int max14577_charger_probe(struct platform_device *pdev)
>  	chg->max14577 = max14577;
>  
>  	chg->pdata = max14577_charger_dt_init(pdev);

Thanks for the fix. I would prefer to fix the max14577_charger_dt_init()
stub to return ERR_PTR(-ENODATA) in such case  and then you have here
only if (IS_ERR()).

> -	if (IS_ERR_OR_NULL(chg->pdata))
Best regards,
Krzysztof

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ