Commit afe64245 authored by Michael Zhivich's avatar Michael Zhivich Committed by David S. Miller

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: default avatarMichael Zhivich <mzhivich@akamai.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 3c5189ad
...@@ -1591,7 +1591,7 @@ enum ethtool_link_mode_bit_indices { ...@@ -1591,7 +1591,7 @@ enum ethtool_link_mode_bit_indices {
static inline int ethtool_validate_speed(__u32 speed) 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. */ /* Duplex, half or full. */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment