summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid S. Miller2015-07-12 08:25:16 +0200
committerDavid S. Miller2015-07-12 08:25:16 +0200
commit76b63da9666fb3fa786ff76a50d29abbe3d706b8 (patch)
treeb35f6925713d88442f5a3e5d2490b9165ba42b29
parentnet: switchdev: don't abort unsupported operations (diff)
parentnet: dsa: Fix off-by-one in switch address parsing (diff)
downloadkernel-qcow2-linux-76b63da9666fb3fa786ff76a50d29abbe3d706b8.tar.gz
kernel-qcow2-linux-76b63da9666fb3fa786ff76a50d29abbe3d706b8.tar.xz
kernel-qcow2-linux-76b63da9666fb3fa786ff76a50d29abbe3d706b8.zip
Merge branch 'dsa-of-parsing-fixes'
Florian Fainelli says: ==================== net: dsa: OF parsing fixes This patch series fixes two small parsing issues, the first one was reported by Dan, the second came after looking more closely at the code. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--net/dsa/dsa.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c
index 392e29a0227d..b445d492c115 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))
@@ -642,6 +642,8 @@ static int dsa_of_probe(struct device *dev)
continue;
port_index = be32_to_cpup(port_reg);
+ if (port_index >= DSA_MAX_PORTS)
+ break;
port_name = of_get_property(port, "label", NULL);
if (!port_name)
@@ -666,8 +668,6 @@ static int dsa_of_probe(struct device *dev)
goto out_free_chip;
}
- if (port_index == DSA_MAX_PORTS)
- break;
}
}