mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] power: supply: Fix uninitialized variable in ip5xxx_battery_set_property
@ 2024-12-09 21:23 Karol Przybylski
  2024-12-09 23:09 ` Csókás Bence
  0 siblings, 1 reply; 2+ messages in thread
From: Karol Przybylski @ 2024-12-09 21:23 UTC (permalink / raw)
  To: karprzy7, samuel, sre; +Cc: linux-pm, linux-kernel, skhan

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-12-09 23:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-12-09 21:23 [PATCH] power: supply: Fix uninitialized variable in ip5xxx_battery_set_property Karol Przybylski
2024-12-09 23:09 ` Csókás Bence

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®