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: <20190314183316.97259E0090@unicorn.suse.cz>
Date:   Thu, 14 Mar 2019 19:33:16 +0100 (CET)
From:   Michal Kubecek <mkubecek@...e.cz>
To:     "John W. Linville" <linville@...driver.com>
Cc:     netdev@...r.kernel.org,
        Vidya Sagar Ravipati <vidya@...ulusnetworks.com>
Subject: [PATCH ethtool] ethtool: qsfp: fix special value comparison

One of the warnings gcc issues when building ethtool with -Wall seems to
point to an actual problem:

qsfp.c: In function 'sff8636_show_dom':
qsfp.c:709:57: warning: comparison is always false due to limited range of data type [-Wtype-limits]
  if ((sd.sfp_temp[MCURR] == 0x0) || (sd.sfp_temp[MCURR] == 0xFFFF))
                                                          ^~

Rather than writing the special value as -1 which would be a bit confusing,
cast 0xFFFF to __s16.

Fixes: a5e73bb05ee4 ("ethtool:QSFP Plus/QSFP28 Diagnostics Information Support")
Signed-off-by: Michal Kubecek <mkubecek@...e.cz>
---
 qsfp.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/qsfp.c b/qsfp.c
index d196aa1753de..d0774b0445c8 100644
--- a/qsfp.c
+++ b/qsfp.c
@@ -706,7 +706,8 @@ static void sff8636_show_dom(const __u8 *id, __u32 eeprom_len)
 	 * current fields are supported or not. A valid temperature
 	 * reading is used as existence for TX/RX power.
 	 */
-	if ((sd.sfp_temp[MCURR] == 0x0) || (sd.sfp_temp[MCURR] == 0xFFFF))
+	if ((sd.sfp_temp[MCURR] == 0x0) ||
+	    (sd.sfp_temp[MCURR] == (__s16)0xFFFF))
 		return;
 
 	printf("\t%-41s : %s\n", "Alarm/warning flags implemented",
-- 
2.21.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ