mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Csókás Bence" <csokas.bence@prolan.hu>
To: Karol Przybylski <karprzy7@gmail.com>, <samuel@sholland.org>,
	<sre@kernel.org>
Cc: <linux-pm@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<skhan@linuxfoundation.org>
Subject: Re: [PATCH] power: supply: Fix uninitialized variable in ip5xxx_battery_set_property
Date: Tue, 10 Dec 2024 00:09:57 +0100	[thread overview]
Message-ID: <4e9be877-0cbd-4794-9601-39721ca9b698@prolan.hu> (raw)
In-Reply-To: <20241209212323.71228-1-karprzy7@gmail.com>

Hi,

On 2024. 12. 09. 22:23, Karol Przybylski wrote:
> The variable vmax in the ip5xxx_battery_set_property function is used uninitialized when passed to switch/case statements.
> 
> This patch initializes vmax to 0 at declaration.
> 
> Issue discovered in coverity, CID 1602239
> 
> Signed-off-by: Karol Przybylski <karprzy7@gmail.com>
> ---
>   drivers/power/supply/ip5xxx_power.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/power/supply/ip5xxx_power.c b/drivers/power/supply/ip5xxx_power.c
> index 4bcf0ea0e..65d3266c3 100644
> --- a/drivers/power/supply/ip5xxx_power.c
> +++ b/drivers/power/supply/ip5xxx_power.c
> @@ -541,7 +541,7 @@ static int ip5xxx_battery_set_property(struct power_supply *psy,
>   {
>   	struct ip5xxx *ip5xxx = power_supply_get_drvdata(psy);
>   	unsigned int rval;
> -	int ret, vmax;
> +	int ret, vmax = 0;
>   
>   	ret = ip5xxx_initialize(psy);
>   	if (ret)

This is not the proper way to fix this. See my patch below.
Link: 
https://lore.kernel.org/linux-kernel/20241208131532.1028581-1-csokas.bence@prolan.hu/

Bence


      reply	other threads:[~2024-12-09 23:10 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-09 21:23 Karol Przybylski
2024-12-09 23:09 ` Csókás Bence [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4e9be877-0cbd-4794-9601-39721ca9b698@prolan.hu \
    --to=csokas.bence@prolan.hu \
    --cc=karprzy7@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=samuel@sholland.org \
    --cc=skhan@linuxfoundation.org \
    --cc=sre@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®