diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2022-02-07 11:22:53 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2022-02-07 12:35:10 +0000 |
commit | dde41a697331fdcf1fd0eae85dc061d289626f1e (patch) | |
tree | 419487c44ba155752cbbeedffc53c6f394265e21 /drivers/net | |
parent | 87a9b2fd9288c56c0cbfb09f31a5e864d4bdde61 (diff) |
net: dsa: mv88e6xxx: Fix off by in one in mv88e6185_phylink_get_caps()
The <= ARRAY_SIZE() needs to be < ARRAY_SIZE() to prevent an out of
bounds error.
Fixes: d4ebf12bcec4 ("net: dsa: mv88e6xxx: populate supported_interfaces and mac_capabilities")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/dsa/mv88e6xxx/chip.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c index 7670796c2aa1..192a7688b4df 100644 --- a/drivers/net/dsa/mv88e6xxx/chip.c +++ b/drivers/net/dsa/mv88e6xxx/chip.c @@ -585,7 +585,7 @@ static void mv88e6185_phylink_get_caps(struct mv88e6xxx_chip *chip, int port, { u8 cmode = chip->ports[port].cmode; - if (cmode <= ARRAY_SIZE(mv88e6185_phy_interface_modes) && + if (cmode < ARRAY_SIZE(mv88e6185_phy_interface_modes) && mv88e6185_phy_interface_modes[cmode]) __set_bit(mv88e6185_phy_interface_modes[cmode], config->supported_interfaces); |