1
0
Fork 0

net: dsa: Fix off-by-one in switch address parsing

cd->sw_addr is used as a MDIO bus address, which cannot exceed
PHY_MAX_ADDR (32), our check was off-by-one.

Fixes: 5e95329b70 ("dsa: add device tree bindings to register DSA switches")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
hifive-unleashed-5.1
Florian Fainelli 2015-07-11 18:02:11 -07:00 committed by David S. Miller
parent 8f5063e97f
commit c8cf89f73f
1 changed files with 1 additions and 1 deletions

View File

@ -630,7 +630,7 @@ static int dsa_of_probe(struct device *dev)
continue;
cd->sw_addr = be32_to_cpup(sw_addr);
if (cd->sw_addr > PHY_MAX_ADDR)
if (cd->sw_addr >= PHY_MAX_ADDR)
continue;
if (!of_property_read_u32(child, "eeprom-length", &eeprom_len))