Skip to content

Commit c8cf89f

Browse files
ffainellidavem330
authored andcommitted
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: 5e95329 ("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>
1 parent 8f5063e commit c8cf89f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

net/dsa/dsa.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -630,7 +630,7 @@ static int dsa_of_probe(struct device *dev)
630630
continue;
631631

632632
cd->sw_addr = be32_to_cpup(sw_addr);
633-
if (cd->sw_addr > PHY_MAX_ADDR)
633+
if (cd->sw_addr >= PHY_MAX_ADDR)
634634
continue;
635635

636636
if (!of_property_read_u32(child, "eeprom-length", &eeprom_len))

0 commit comments

Comments
 (0)