[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220207082253.GA28514@kili>
Date: Mon, 7 Feb 2022 11:22:53 +0300
From: Dan Carpenter <dan.carpenter@...cle.com>
To: Andrew Lunn <andrew@...n.ch>,
Russell King <rmk+kernel@...linux.org.uk>
Cc: Vivien Didelot <vivien.didelot@...il.com>,
Florian Fainelli <f.fainelli@...il.com>,
Vladimir Oltean <olteanv@...il.com>,
"David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
Marek BehĂșn <kabel@...nel.org>,
netdev@...r.kernel.org, kernel-janitors@...r.kernel.org
Subject: [PATCH 1/2 net-next] 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@...cle.com>
---
drivers/net/dsa/mv88e6xxx/chip.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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);
--
2.20.1
Powered by blists - more mailing lists