From: Florian Fainelli Date: Sun, 12 Jul 2015 01:02:11 +0000 (-0700) Subject: net: dsa: Fix off-by-one in switch address parsing X-Git-Tag: v5.15~15428^2~1^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c8cf89f73f3d9ecbdea479778f0ac714be79be33;p=platform%2Fkernel%2Flinux-starfive.git 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: 5e95329b701c ("dsa: add device tree bindings to register DSA switches") Signed-off-by: Florian Fainelli Signed-off-by: David S. Miller --- diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c index 52beeb8..b445d49 100644 --- a/net/dsa/dsa.c +++ b/net/dsa/dsa.c @@ -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))