Skip to contentSkip to conversation

dsa: do not dereference non-existing routing table

PATCH Applied Tobias Waldekranz 2 participants 2 messages Feb 5, 2015 – Feb 8, 2015

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dsa: do not dereference non-existing routing table

In the case where there is only one switch, no routing table will have been allocated, so do not dereference it in this case.

---
 drivers/net/dsa/mv88e6131.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/dsa/mv88e6131.c +2 -1
index 1fc98e7..eadb27c 100644
@@ -142,7 +142,8 @@ static int mv88e6131_setup_global(struct dsa_switch *ds)
 		int nexthop;
 
 		nexthop = 0x1f;
-		if (i != ds->index && i < ds->dst->pd->nr_chips)
+		if (ds->pd->rtable &&
+		    i != ds->index && i < ds->dst->pd->nr_chips)
 			nexthop = ds->pd->rtable[i] & 0x1f;
 
 		REG_WRITE(REG_GLOBAL2, 0x06, 0x8000 | (i << 8) | nexthop);
Signature · 1 line
1.8.4.357.g8d83871.dirty