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]
Date:   Thu, 7 May 2020 13:16:17 +0800
From:   ChenTao <chentao107@...wei.com>
To:     <dmitry.torokhov@...il.com>
CC:     <kstewart@...uxfoundation.org>, <tglx@...utronix.de>,
        <gregkh@...uxfoundation.org>, <allison@...utok.net>,
        <linux-kernel@...r.kernel.org>, <chentao107@...wei.com>
Subject: [PATCH] input/misc/drv260x: Remove a useless comparison

Fix the following warning:

'mode' and 'library' are u32, they are never be negative,
DRV260X_LRA_MODE and DRV260X_LIB_EMPTY are 0x00, the comparison
is always false.

drivers/input/misc/drv260x.c:478:20: warning:
comparison of unsigned expression < 0 is always false [-Wtype-limits]
  if (haptics->mode < DRV260X_LRA_MODE ||
drivers/input/misc/drv260x.c:490:23: warning:
comparison of unsigned expression < 0 is always false [-Wtype-limits]
  if (haptics->library < DRV260X_LIB_EMPTY ||

Reported-by: Hulk Robot <hulkci@...wei.com>
Signed-off-by: ChenTao <chentao107@...wei.com>
---
 drivers/input/misc/drv260x.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/input/misc/drv260x.c b/drivers/input/misc/drv260x.c
index 79d7fa710a71..0078f742df5c 100644
--- a/drivers/input/misc/drv260x.c
+++ b/drivers/input/misc/drv260x.c
@@ -475,8 +475,7 @@ static int drv260x_probe(struct i2c_client *client,
 		return error;
 	}
 
-	if (haptics->mode < DRV260X_LRA_MODE ||
-	    haptics->mode > DRV260X_ERM_MODE) {
+	if (haptics->mode > DRV260X_ERM_MODE) {
 		dev_err(dev, "Vibrator mode is invalid: %i\n", haptics->mode);
 		return -EINVAL;
 	}
@@ -487,8 +486,7 @@ static int drv260x_probe(struct i2c_client *client,
 		return error;
 	}
 
-	if (haptics->library < DRV260X_LIB_EMPTY ||
-	    haptics->library > DRV260X_ERM_LIB_F) {
+	if (haptics->library > DRV260X_ERM_LIB_F) {
 		dev_err(dev,
 			"Library value is invalid: %i\n", haptics->library);
 		return -EINVAL;
-- 
2.22.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ