Skip to content

Commit afe6424

Browse files
michaelzhivichdavem330
authored andcommitted
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>
1 parent 3c5189a commit afe6424

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

include/uapi/linux/ethtool.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1591,7 +1591,7 @@ enum ethtool_link_mode_bit_indices {
15911591

15921592
static inline int ethtool_validate_speed(__u32 speed)
15931593
{
1594-
return speed <= INT_MAX || speed == SPEED_UNKNOWN;
1594+
return speed <= INT_MAX || speed == (__u32)SPEED_UNKNOWN;
15951595
}
15961596

15971597
/* Duplex, half or full. */

0 commit comments

Comments
 (0)