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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230813110841.130206-1-coolrrsh@gmail.com>
Date:   Sun, 13 Aug 2023 16:38:41 +0530
From:   coolrrsh@...il.com
To:     Shyam-sundar.S-k@....com, hdegoede@...hat.com,
        markgross@...nel.org, platform-driver-x86@...r.kernel.org,
        linux-kernel@...r.kernel.org
Cc:     linux-kernel-mentees@...ts.linuxfoundation.org,
        Rajeshwar R Shinde <coolrrsh@...il.com>
Subject: [PATCH v2] platform: sps: Fix an unsigned comparison that can never be negative

From: Rajeshwar R Shinde <coolrrsh@...il.com>

The variable 'mode' is declared as unsigned int in local function.
The return value of function amd_pmf_get_pprof_modes(dev) is int and
it is stored in the 'mode' variable. Also the value of 'mode' variable
is compared with 0 which is signed int by default. Thus redeclaring the
variable to signed int.

This fixes warning such as:
drivers/platform/x86/amd/pmf/sps.c:128:5-9:
WARNING: Unsigned expression compared with zero: mode < 0

Signed-off-by: Rajeshwar R Shinde <coolrrsh@...il.com>

---
v1->v2
changed the commit subject
---
 drivers/platform/x86/amd/pmf/sps.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/platform/x86/amd/pmf/sps.c b/drivers/platform/x86/amd/pmf/sps.c
index ab69d517a36a..703723a66830 100644
--- a/drivers/platform/x86/amd/pmf/sps.c
+++ b/drivers/platform/x86/amd/pmf/sps.c
@@ -176,7 +176,7 @@ int amd_pmf_get_pprof_modes(struct amd_pmf_dev *pmf)
 
 int amd_pmf_power_slider_update_event(struct amd_pmf_dev *dev)
 {
-	u8 mode, flag = 0;
+	int mode, flag = 0;
 	int src;
 
 	mode = amd_pmf_get_pprof_modes(dev);
-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ