aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/phy
diff options
context:
space:
mode:
authorColin Ian King <colin.king@canonical.com>2018-11-12 23:45:56 +0000
committerDavid S. Miller <davem@davemloft.net>2018-11-12 16:26:21 -0800
commit3e536cff34244959c81575733c9ca60633f74e1b (patch)
tree210f62e76bac75f4f931dce4f63696f0bd75b1ce /drivers/net/phy
parentMerge branch 'sctp-add-support-for-sk_reuseport' (diff)
downloadlinux-dev-3e536cff34244959c81575733c9ca60633f74e1b.tar.xz
linux-dev-3e536cff34244959c81575733c9ca60633f74e1b.zip
net: phy: check if advertising is zero using linkmode_empty
A recent change modified variable advertising from a u32 to a link mode array and left the u32 zero comparison, so essential we now have an array being compared to null which is not the intention. Fix this by using the call to linkmode_empty to check if advertising is all zero. Detected by CoverityScan, CID#1475424 ("Array compared against 0") Fixes: 3c1bcc8614db ("net: ethernet: Convert phydev advertize and supported from u32 to link mode") Signed-off-by: Colin Ian King <colin.king@canonical.com> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/phy')
-rw-r--r--drivers/net/phy/phy.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index d73873334e47..376a0d8a2b61 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -328,7 +328,7 @@ int phy_ethtool_ksettings_set(struct phy_device *phydev,
if (autoneg != AUTONEG_ENABLE && autoneg != AUTONEG_DISABLE)
return -EINVAL;
- if (autoneg == AUTONEG_ENABLE && advertising == 0)
+ if (autoneg == AUTONEG_ENABLE && linkmode_empty(advertising))
return -EINVAL;
if (autoneg == AUTONEG_DISABLE &&