mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] power: supply: Added check for negative values
@ 2022-12-06  9:17 Denis Arefev
  2022-12-06 17:11 ` Hans de Goede
  0 siblings, 1 reply; 5+ messages in thread
From: Denis Arefev @ 2022-12-06  9:17 UTC (permalink / raw)
  To: Sebastian Reichel
  Cc: Chen-Yu Tsai, Hans de Goede, linux-pm, linux-kernel, lvc-project,
	trufanov, vfh

Variable 'pirq', which may receive negative value
in platform_get_irq().
Used as an index in a function regmap_irq_get_virq().

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Signed-off-by: Denis Arefev <arefev@swemel.ru>
---
 drivers/power/supply/axp288_fuel_gauge.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/power/supply/axp288_fuel_gauge.c b/drivers/power/supply/axp288_fuel_gauge.c
index 148eb8105803..36c7039c99c2 100644
--- a/drivers/power/supply/axp288_fuel_gauge.c
+++ b/drivers/power/supply/axp288_fuel_gauge.c
@@ -640,6 +640,8 @@ static void fuel_gauge_init_irq(struct axp288_fg_info *info)
 
 	for (i = 0; i < AXP288_FG_INTR_NUM; i++) {
 		pirq = platform_get_irq(info->pdev, i);
+		if (pirq < 0)
+			continue;
 		info->irq[i] = regmap_irq_get_virq(info->regmap_irqc, pirq);
 		if (info->irq[i] < 0) {
 			dev_warn(&info->pdev->dev,
-- 
2.25.1


^ permalink raw reply	[flat|nested] 5+ messages in thread
* [PATCH] power: supply: Added check for negative values
@ 2022-11-17 12:01 Denis Arefev
  2022-11-17 22:45 ` Sebastian Reichel
  0 siblings, 1 reply; 5+ messages in thread
From: Denis Arefev @ 2022-11-17 12:01 UTC (permalink / raw)
  To: Sebastian Reichel
  Cc: Chen-Yu Tsai, Hans de Goede, linux-pm, linux-kernel, lvc-patches,
	trufanov, vfh

Variable 'pirq', which may receive negative value
in platform_get_irq().
Used as an index in a function regmap_irq_get_virq().

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Signed-off-by: Denis Arefev <arefev@swemel.ru>
---
 drivers/power/supply/axp288_fuel_gauge.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/power/supply/axp288_fuel_gauge.c b/drivers/power/supply/axp288_fuel_gauge.c
index 148eb8105803..36c7039c99c2 100644
--- a/drivers/power/supply/axp288_fuel_gauge.c
+++ b/drivers/power/supply/axp288_fuel_gauge.c
@@ -640,6 +640,8 @@ static void fuel_gauge_init_irq(struct axp288_fg_info *info)
 
 	for (i = 0; i < AXP288_FG_INTR_NUM; i++) {
 		pirq = platform_get_irq(info->pdev, i);
+		if (pirq < 0)
+			continue;
 		info->irq[i] = regmap_irq_get_virq(info->regmap_irqc, pirq);
 		if (info->irq[i] < 0) {
 			dev_warn(&info->pdev->dev,
-- 
2.25.1


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

end of thread, other threads:[~2023-01-02 22:21 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-06  9:17 [PATCH] power: supply: Added check for negative values Denis Arefev
2022-12-06 17:11 ` Hans de Goede
2023-01-02 22:19   ` Sebastian Reichel
  -- strict thread matches above, loose matches on Subject: below --
2022-11-17 12:01 Denis Arefev
2022-11-17 22:45 ` Sebastian Reichel

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®