From: Michael Zhivich Date: Mon, 8 Apr 2019 14:48:45 +0000 (-0400) Subject: ethtool: avoid signed-unsigned comparison in ethtool_validate_speed() X-Git-Tag: v5.4.17~3832^2~2^2~2 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=afe64245af9f58267e7fa8fb76ad5650ee7ec25f;p=arm%2Flinux.git 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 Signed-off-by: David S. Miller --- diff --git a/include/uapi/linux/ethtool.h b/include/uapi/linux/ethtool.h index 3652b239dad1..d473e5ed044c 100644 --- a/include/uapi/linux/ethtool.h +++ b/include/uapi/linux/ethtool.h @@ -1591,7 +1591,7 @@ enum ethtool_link_mode_bit_indices { static inline int ethtool_validate_speed(__u32 speed) { - return speed <= INT_MAX || speed == SPEED_UNKNOWN; + return speed <= INT_MAX || speed == (__u32)SPEED_UNKNOWN; } /* Duplex, half or full. */