Skip to content

Commit bf6c880

Browse files
Denis Arefevsre
authored andcommitted
power: supply: axp288_fuel_gauge: 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. Signed-off-by: Denis Arefev <arefev@swemel.ru> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
1 parent 14c76b2 commit bf6c880

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

drivers/power/supply/axp288_fuel_gauge.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -724,6 +724,8 @@ static int axp288_fuel_gauge_probe(struct platform_device *pdev)
724724

725725
for (i = 0; i < AXP288_FG_INTR_NUM; i++) {
726726
pirq = platform_get_irq(pdev, i);
727+
if (pirq < 0)
728+
continue;
727729
ret = regmap_irq_get_virq(axp20x->regmap_irqc, pirq);
728730
if (ret < 0)
729731
return dev_err_probe(dev, ret, "getting vIRQ %d\n", pirq);

0 commit comments

Comments
 (0)