diff options
author | Florian Fainelli <f.fainelli@gmail.com> | 2015-07-11 21:02:11 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-07-12 02:25:16 -0400 |
commit | c8cf89f73f3d9ecbdea479778f0ac714be79be33 (patch) | |
tree | b35f6925713d88442f5a3e5d2490b9165ba42b29 /net | |
parent | 8f5063e97f393d49611151d3cf7dcbeb41397f12 (diff) |
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 <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/dsa/dsa.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c index 52beeb8829dc..b445d492c115 100644 --- a/net/dsa/dsa.c +++ b/net/dsa/dsa.c | |||
@@ -630,7 +630,7 @@ static int dsa_of_probe(struct device *dev) | |||
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)) |