diff options
author | Michael Zhivich <mzhivich@akamai.com> | 2019-04-08 16:48:46 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2019-04-09 01:30:43 +0200 |
commit | caf2c5205d82ff0d758096a69a7e0466c38d4dbb (patch) | |
tree | 3637c18af6bfa796964d45c512bcd87ec14606ee /drivers/net/ethernet/broadcom/tg3.h | |
parent | ethtool: avoid signed-unsigned comparison in ethtool_validate_speed() (diff) | |
download | linux-caf2c5205d82ff0d758096a69a7e0466c38d4dbb.tar.xz linux-caf2c5205d82ff0d758096a69a7e0466c38d4dbb.zip |
broadcom: tg3: fix use of SPEED_UNKNOWN ethtool constant
tg3 driver uses u16 to store SPEED_UKNOWN ethtool constant,
which is defined as -1, resulting in value truncation and
thus incorrect test results against SPEED_UNKNOWN.
For example, the following test will print "False":
u16 speed = SPEED_UNKNOWN;
if (speed == SPEED_UNKNOWN)
printf("True");
else
printf("False");
Change storage of speed to use u32 to avoid this issue.
Signed-off-by: Michael Zhivich <mzhivich@akamai.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/broadcom/tg3.h')
-rw-r--r-- | drivers/net/ethernet/broadcom/tg3.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/net/ethernet/broadcom/tg3.h b/drivers/net/ethernet/broadcom/tg3.h index a772a33b685c..6953d0546acb 100644 --- a/drivers/net/ethernet/broadcom/tg3.h +++ b/drivers/net/ethernet/broadcom/tg3.h @@ -2873,7 +2873,7 @@ struct tg3_tx_ring_info { struct tg3_link_config { /* Describes what we're trying to get. */ u32 advertising; - u16 speed; + u32 speed; u8 duplex; u8 autoneg; u8 flowctrl; @@ -2882,7 +2882,7 @@ struct tg3_link_config { u8 active_flowctrl; u8 active_duplex; - u16 active_speed; + u32 active_speed; u32 rmt_adv; }; |