From patchwork Thu Nov 17 12:01:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Arefev X-Patchwork-Id: 21599 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp360210wrr; Thu, 17 Nov 2022 04:04:05 -0800 (PST) X-Google-Smtp-Source: AA0mqf4b7cmnVFN+50DtO8hUfS4JeNXr1ioNPajfdLWqC1C2AMYC7EQgCziIx7zGBfrJDJbhA1Jv X-Received: by 2002:aa7:ccc9:0:b0:462:30e4:fcf5 with SMTP id y9-20020aa7ccc9000000b0046230e4fcf5mr1874236edt.115.1668686645649; Thu, 17 Nov 2022 04:04:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668686645; cv=none; d=google.com; s=arc-20160816; b=fBWzGBGlZvahHYZSkTUdXm7a6Xptlm22HDcSW1EQjTFGnht1FqpnUgz/L4txXmuJDD sa0ix8qidVn38vriCM4jUKjhTxMPkjIaecR34oBO+h9zchhca1jDJjRIasuBw6JjTpVX OKuRx2sB53NQGsKSgvL8vMFdNNsIhgpXGralLCvifstd6c2EupeKBmoygxArP+WJv6PI atsHx1KUlJCKXppzy5TRLir1FvMng0s5BrkNGd2L2gFQij0GVmS7hZasnEq1IOFHzFjR o7YKH41Q3JWs0HAwRy3XJFKM5lHuirY+Pe7FlKVpfFRhm8ReqrFeaYJvtk7/4KCqFMTV 4s2w== 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=fVIA5zIPG2SwtMmx9v+aaDSoanP0gEqDHWu1enGREU5HR113fWrcsCJCs+rnlopcn8 CudP7u+FIxgMN7DCEOANYi6TxytByzePjamTKher4B8FqYiFIUZIM/QIdkx7q32bPg+f iRjiumcD1yNPR+6mN3uQicJiHYbL+7+Q9a16amSs2+njzSywyOISzRe17zvR4sid70rw bHehCa5o/p5k/ikTCjhJY70mCFOL347YiIucmpUHiH9SJ8HpGjWyAhcKNZ/xWSIRPtmo YKxVMwgsUEXoKU/Zw6l1V5Y1WtBAO3T9bdi6BRpghkbyaBmqU4FfG1Tui6UNI4YsT2gh Jnsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@swemel.ru header.s=mail header.b=s9XEMn87; 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 x11-20020a05640226cb00b0046311e80ebcsi785086edd.151.2022.11.17.04.03.37; Thu, 17 Nov 2022 04:04:05 -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=s9XEMn87; 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 S239851AbiKQMCK (ORCPT + 99 others); Thu, 17 Nov 2022 07:02:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33520 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239896AbiKQMBs (ORCPT ); Thu, 17 Nov 2022 07:01:48 -0500 Received: from mx.swemel.ru (mx.swemel.ru [95.143.211.150]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6F21959FE8; Thu, 17 Nov 2022 04:01:44 -0800 (PST) From: Denis Arefev DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=swemel.ru; s=mail; t=1668686500; 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=s9XEMn872hGlytHJ1n3LB32DjIrVnEMxL1+/h0qVx8jNx8bhMXujyeUNTXF5H2jThWOtsB Oo2Qa/tT/wVPHpCfOmIwskELJzkf9R3T4paKA/sCDNgv2PKMHVw4scdZD5GPw8/qQ81IGz QeE/7CRsJyryXyfd0sztD4yrng+EieY= To: Sebastian Reichel Cc: Chen-Yu Tsai , Hans de Goede , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, lvc-patches@linuxtesting.org, trufanov@swemel.ru, vfh@swemel.ru Subject: [PATCH] power: supply: Added check for negative values Date: Thu, 17 Nov 2022 15:01:40 +0300 Message-Id: <20221117120140.103208-1-arefev@swemel.ru> MIME-Version: 1.0 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749744768015026027?= X-GMAIL-MSGID: =?utf-8?q?1749744768015026027?= 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 --- 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,