History

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.

Florian Fainelli committed 11 years ago

Commit c8cf89f1 parent 8f5063e1 file · +1 −1Browse files

Unified · Split

net/dsa/dsa.c+1−1
@@ -630,7 +630,7 @@ static int dsa_of_probe(struct device *dev) · 629 unmodified lines
630 continue;630 continue;
631 631
632 cd->sw_addr = be32_to_cpup(sw_addr);632 cd->sw_addr = be32_to_cpup(sw_addr);
633 if (cd->sw_addr > PHY_MAX_ADDR)633 if (cd->sw_addr >= PHY_MAX_ADDR)
634 continue;634 continue;
635 635
636 if (!of_property_read_u32(child, "eeprom-length", &eeprom_len))636 if (!of_property_read_u32(child, "eeprom-length", &eeprom_len))