Commit 0e1b541b authored by Florian Fainelli's avatar Florian Fainelli Committed by Luis Henriques

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

commit c8cf89f7 upstream.

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

Fixes: 5e95329b ("dsa: add device tree bindings to register DSA switches")
Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarLuis Henriques <luis.henriques@canonical.com>
parent a72eb546
......@@ -418,7 +418,7 @@ static int dsa_of_probe(struct platform_device *pdev)
continue;
cd->sw_addr = be32_to_cpup(sw_addr);
if (cd->sw_addr > PHY_MAX_ADDR)
if (cd->sw_addr >= PHY_MAX_ADDR)
continue;
for_each_available_child_of_node(child, port) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment