Message ID | 20221206091723.28656-1-arefev@swemel.ru |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2717970wrr; Tue, 6 Dec 2022 01:24:37 -0800 (PST) X-Google-Smtp-Source: AA0mqf5WDSEYxHACNptwWQohcjP26gZg1dGVQPO95V0B5028w/jSjFoKXm0PneumPSEh3HLEW2ay X-Received: by 2002:a17:907:c719:b0:7ae:31a0:e22f with SMTP id ty25-20020a170907c71900b007ae31a0e22fmr32166792ejc.248.1670318677783; Tue, 06 Dec 2022 01:24:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670318677; cv=none; d=google.com; s=arc-20160816; b=w18DOgmagxDDiYmf1OVJUfqRALGAoNpf4PjJg5l3Y+UYGy0Hp1awNQcsuR8mRpEulp TkGsrKN6XGF/7DBd9l+G0ywXOnuHfLN3l1VSo3o2HDkfJpYmkoglTAy84kgdKonN707a d7PoXTW/PHhyr++Bd/JMLs5i0BU2vqFoqU+ai1eDqFvak2jcH27H3T0bly7lK1AZFvGN pdY6kuBpeiUDtAN41+pQVLIMMRTZSyi64IYDB/8AqKUovxgN4PB6MxabvH8EEkaDO9dA k+8Nwpxx/mRr/Lbsy/3UhLERVCx/dyM8z5LeU3hqcvN2NOzkNq8nk08RiviYgAC7b5TO cMIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:dkim-signature:from; bh=L6AmVYk+3czGQRwn6dfUAWPTlXwM30IpBMZAykr0mwg=; b=hJlW95knnfAvYjEJY5mWGYrKncuVZwOne73RqDb//jFRtrgYbEpS3jjs16r05efw0x RIZQjeyLV9VtUCC/0nPqoMhY5EHg09Iqv6XrPLRNM9oGm9xnYJGXPmtg4JZbEGR8sciT Ca3FFy/DekQzNvMaEAftoEQk6OctrhJwkdOyJz7GEhvA/Tqg230dWvm5RjEhP9RG19p4 MFIZkGUbj9Gniqg+LXnB4/W41mH80TbwLTqwiG6bT888G5dd3AsmdqJcwtr5CJW90ph8 4olmUxXZrpZNx3dmtj7Z7gU5PY6vlquK7+2sRCLFjn3yvPrezEdB0tNqkVMMaKllwIsK 4c9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@swemel.ru header.s=mail header.b=EXaZd0aw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=swemel.ru Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id kf27-20020a17090776db00b0078cffe5dcdesi11761289ejc.451.2022.12.06.01.24.14; Tue, 06 Dec 2022 01:24:37 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@swemel.ru header.s=mail header.b=EXaZd0aw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=swemel.ru Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235015AbiLFJTc (ORCPT <rfc822;jaysivo@gmail.com> + 99 others); Tue, 6 Dec 2022 04:19:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60880 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233558AbiLFJRl (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 6 Dec 2022 04:17:41 -0500 Received: from mx.swemel.ru (mx.swemel.ru [95.143.211.150]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 94A741F9E2; Tue, 6 Dec 2022 01:17:27 -0800 (PST) From: Denis Arefev <arefev@swemel.ru> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=swemel.ru; s=mail; t=1670318243; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=L6AmVYk+3czGQRwn6dfUAWPTlXwM30IpBMZAykr0mwg=; b=EXaZd0awXs7QnHyQ6CVLCrXaKkMPfUg3zglbCFyGPKonX14N3Jwrvp9bFdSN1npg0LCJdA SmItxkhCPnSp+ivyly5ikx48qQV5Rux61FthN/SkwTdTc/jMVu4cvce7oVtn3SBTuFScOh HgyQvzpCy8AmYe1dghreK65S4K6ucdc= To: Sebastian Reichel <sre@kernel.org> Cc: Chen-Yu Tsai <wens@csie.org>, Hans de Goede <hdegoede@redhat.com>, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, lvc-project@linuxtesting.org, trufanov@swemel.ru, vfh@swemel.ru Subject: [PATCH] power: supply: Added check for negative values Date: Tue, 6 Dec 2022 12:17:23 +0300 Message-Id: <20221206091723.28656-1-arefev@swemel.ru> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1751456077866723240?= X-GMAIL-MSGID: =?utf-8?q?1751456077866723240?= |
Series |
power: supply: Added check for negative values
|
|
Commit Message
Denis Arefev
Dec. 6, 2022, 9:17 a.m. UTC
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(+)
Comments
Hi, On 12/6/22 10:17, Denis Arefev wrote: > 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> Thanks, patch looks good to me: Reviewed-by: Hans de Goede <hdegoede@redhat.com> Regards, Hans > --- > 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,
Hi, On Tue, Dec 06, 2022 at 06:11:23PM +0100, Hans de Goede wrote: > Hi, > > On 12/6/22 10:17, Denis Arefev wrote: > > 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> > > Thanks, patch looks good to me: > > Reviewed-by: Hans de Goede <hdegoede@redhat.com> > > Regards, > > Hans Thanks, queued to power-supply's fixes branch. -- Sebastian > > > --- > > 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, >
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,