Skip to content

Commit

Permalink
ethtool: avoid signed-unsigned comparison in ethtool_validate_speed()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Michael Zhivich authored and David S. Miller committed Apr 8, 2019
1 parent 3c5189a commit afe6424
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion include/uapi/linux/ethtool.h
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand Down

0 comments on commit afe6424

Please sign in to comment.