Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ethtool: avoid signed-unsigned comparison in ethtool_validate_speed()

When building C++ userspace code that includes ethtool.h
with "-Werror -Wall", g++ complains about signed-unsigned comparison in
ethtool_validate_speed() due to definition of SPEED_UNKNOWN as -1.

Explicitly cast SPEED_UNKNOWN to __u32 to match type of
ethtool_validate_speed() argument.

Signed-off-by: Michael Zhivich <mzhivich@akamai.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Michael Zhivich and committed by
David S. Miller
afe64245 3c5189ad

+1 -1
+1 -1
include/uapi/linux/ethtool.h
··· 1591 1591 1592 1592 static inline int ethtool_validate_speed(__u32 speed) 1593 1593 { 1594 - return speed <= INT_MAX || speed == SPEED_UNKNOWN; 1594 + return speed <= INT_MAX || speed == (__u32)SPEED_UNKNOWN; 1595 1595 } 1596 1596 1597 1597 /* Duplex, half or full. */