lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20221117120140.103208-1-arefev@swemel.ru>
Date:   Thu, 17 Nov 2022 15:01:40 +0300
From:   Denis Arefev <arefev@...mel.ru>
To:     Sebastian Reichel <sre@...nel.org>
Cc:     Chen-Yu Tsai <wens@...e.org>, Hans de Goede <hdegoede@...hat.com>,
        linux-pm@...r.kernel.org, linux-kernel@...r.kernel.org,
        lvc-patches@...uxtesting.org, trufanov@...mel.ru, vfh@...mel.ru
Subject: [PATCH] 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.

Signed-off-by: Denis Arefev <arefev@...mel.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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ