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.
Showing the changes to include/uapi/linux (1 of 1 file). Show all
Unified · Split
| @@ -1591,7 +1591,7 @@ enum ethtool_link_mode_bit_indices { · 1590 unmodified lines | ||
| 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. */ |