power: supply: Added check for negative values
PATCH 1/1 power: supply: Added check for negative values
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.
--- drivers/power/supply/axp288_fuel_gauge.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/power/supply/axp288_fuel_gauge.c +2 -0
@@ -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,
Signature · 1 line
2.25.1
Hi,
Quoted 7 lines · Denis Arefev
Variable 'pirq', which may receive negative value in
platform_get_irq().
Used as an index in a functionregmap_irq_get_virq().Found by Linux Verification Center (linuxtesting.org) with SVACE.
Signed-off-by Denis Arefev <[email protected]>
Thanks, patch looks good to me:
Regards,
Hans
Quoted 17 lines
--- drivers/power/supply/axp288_fuel_gauge.c | 2 ++ 1 file changed, 2 insertions(+)drivers/power/supply/axp288_fuel_gauge.c +2
-0@@ -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,
Hi,
Quoted 11 lines · Hans de Goede
Hi,
Quoted 7 lines · Denis Arefev
Variable 'pirq', which may receive negative value in
platform_get_irq().
Used as an index in a functionregmap_irq_get_virq().Found by Linux Verification Center (linuxtesting.org) with SVACE.
Signed-off-by Denis Arefev <[email protected]>
Quoted 7 lines
Thanks, patch looks good to me:
Reviewed-by Hans de Goede <[email protected]>Regards,
Hans
Thanks, queued to power-supply's fixes branch.
-- Sebastian
Quoted 19 lines
Quoted 18 lines
--- drivers/power/supply/axp288_fuel_gauge.c | 2 ++ 1 file changed, 2 insertions(+)drivers/power/supply/axp288_fuel_gauge.c +2
-0@@ -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,