[PATCH] dsa: do not dereference non-existing routing table

Subsystems: networking drivers, networking [dsa], the rest

STALE4276d

2 messages, 2 authors, 2015-02-08 · open the first message on its own page

[PATCH] dsa: do not dereference non-existing routing table

From: Tobias Waldekranz <tobias@waldekranz.com>
Date: 2015-02-05 13:52:18

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

Signed-off-by: Tobias Waldekranz <tobias@waldekranz.com>
---
 drivers/net/dsa/mv88e6131.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/dsa/mv88e6131.c b/drivers/net/dsa/mv88e6131.c
index 1fc98e7..eadb27c 100644
--- a/drivers/net/dsa/mv88e6131.c
+++ b/drivers/net/dsa/mv88e6131.c
@@ -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);
-- 
1.8.4.357.g8d83871.dirty

Re: [PATCH] dsa: do not dereference non-existing routing table

From: David Miller <davem@davemloft.net>
Date: 2015-02-08 06:08:11

From: Tobias Waldekranz <tobias@waldekranz.com>
Date: Thu, 5 Feb 2015 14:52:06 +0100
In the case where there is only one switch, no routing table will have
been allocated, so do not dereference it in this case.

Signed-off-by: Tobias Waldekranz <tobias@waldekranz.com>
Applied.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help