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: <20200929170835.GA15956@embeddedor>
Date:   Tue, 29 Sep 2020 12:08:35 -0500
From:   "Gustavo A. R. Silva" <gustavoars@...nel.org>
To:     Will Deacon <will@...nel.org>, Mark Rutland <mark.rutland@....com>,
        Robin Murphy <robin.murphy@....com>
Cc:     linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
        "Gustavo A. R. Silva" <gustavoars@...nel.org>,
        Robin Murphy <robin.murphy@....com>
Subject: [PATCH][next] perf: arm-cmn: Fix unsigned comparison to less than
 zero

Fix unsigned comparison to less than zero by assigning the returned
value of function platform_get_irq() to a new integer variable _ret_
and then make the comparison. In case the returned value is greater
than or equal to zero, assign it to dtc->irq.

Addresses-Coverity-ID: 1497488 ("Unsigned compared against 0")
Fixes: 0ba64770a2f2 ("perf: Add Arm CMN-600 PMU driver")
Signed-off-by: Gustavo A. R. Silva <gustavoars@...nel.org>
---
 drivers/perf/arm-cmn.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/perf/arm-cmn.c b/drivers/perf/arm-cmn.c
index e824b5b83ea2..383b67042677 100644
--- a/drivers/perf/arm-cmn.c
+++ b/drivers/perf/arm-cmn.c
@@ -1246,11 +1246,13 @@ static int arm_cmn_init_dtc(struct arm_cmn *cmn, struct arm_cmn_node *dn, int id
 {
 	struct arm_cmn_dtc *dtc = cmn->dtc + idx;
 	struct arm_cmn_node *xp;
+	int ret;
 
 	dtc->base = dn->pmu_base - CMN_PMU_OFFSET;
-	dtc->irq = platform_get_irq(to_platform_device(cmn->dev), idx);
-	if (dtc->irq < 0)
-		return dtc->irq;
+	ret = platform_get_irq(to_platform_device(cmn->dev), idx);
+	if (ret < 0)
+		return ret;
+	dtc->irq = ret;
 
 	writel_relaxed(0, dtc->base + CMN_DT_PMCR);
 	writel_relaxed(0x1ff, dtc->base + CMN_DT_PMOVSR_CLR);
-- 
2.27.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ