From df67f662a7174052c7c5103fce5c69992dca21cc Mon Sep 17 00:00:00 2001 From: Jiri Slaby <jslaby@suse.cz> Date: Apr 20 2023 11:00:42 +0000 Subject: power: supply: axp288_fuel_gauge: Added check for negative values (bsc#1012628). --- diff --git a/patches.kernel.org/6.2.12-080-power-supply-axp288_fuel_gauge-Added-check-for.patch b/patches.kernel.org/6.2.12-080-power-supply-axp288_fuel_gauge-Added-check-for.patch new file mode 100644 index 0000000..4b3260b --- /dev/null +++ b/patches.kernel.org/6.2.12-080-power-supply-axp288_fuel_gauge-Added-check-for.patch @@ -0,0 +1,41 @@ +From: Denis Arefev <arefev@swemel.ru> +Date: Tue, 6 Dec 2022 12:17:23 +0300 +Subject: [PATCH] power: supply: axp288_fuel_gauge: Added check for negative + values +References: bsc#1012628 +Patch-mainline: 6.2.12 +Git-commit: bf6c880d5d1448489ebf92e2d13d5713ff644930 + +[ Upstream commit bf6c880d5d1448489ebf92e2d13d5713ff644930 ] + +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> +Signed-off-by: Sasha Levin <sashal@kernel.org> +Signed-off-by: Jiri Slaby <jslaby@suse.cz> +--- + 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 8e6f8a65..05f41317 100644 +--- a/drivers/power/supply/axp288_fuel_gauge.c ++++ b/drivers/power/supply/axp288_fuel_gauge.c +@@ -724,6 +724,8 @@ static int axp288_fuel_gauge_probe(struct platform_device *pdev) + + for (i = 0; i < AXP288_FG_INTR_NUM; i++) { + pirq = platform_get_irq(pdev, i); ++ if (pirq < 0) ++ continue; + ret = regmap_irq_get_virq(axp20x->regmap_irqc, pirq); + if (ret < 0) + return dev_err_probe(dev, ret, "getting vIRQ %d\n", pirq); +-- +2.35.3 + diff --git a/series.conf b/series.conf index a9a02e4..906f1f0 100644 --- a/series.conf +++ b/series.conf @@ -2307,6 +2307,7 @@ patches.kernel.org/6.2.12-077-arm64-dts-qcom-sa8540p-ride-correct-name-of-re.patch patches.kernel.org/6.2.12-078-power-supply-rk817-Fix-unsigned-comparison-wit.patch patches.kernel.org/6.2.12-079-power-supply-cros_usbpd-reclassify-default-cas.patch + patches.kernel.org/6.2.12-080-power-supply-axp288_fuel_gauge-Added-check-for.patch ######################################################## # Build fixes that apply to the vanilla kernel too.