public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Karol Przybylski <karprzy7@gmail.com>
To: karprzy7@gmail.com, samuel@sholland.org, sre@kernel.org
Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
	skhan@linuxfoundation.org
Subject: [PATCH] power: supply: Fix uninitialized variable in ip5xxx_battery_set_property
Date: Mon,  9 Dec 2024 22:23:23 +0100	[thread overview]
Message-ID: <20241209212323.71228-1-karprzy7@gmail.com> (raw)

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)
-- 
2.34.1


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

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

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=20241209212323.71228-1-karprzy7@gmail.com \
    --to=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