netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] dsa: do not dereference non-existing routing table
@ 2015-02-05 13:52 Tobias Waldekranz
  2015-02-08  6:08 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Tobias Waldekranz @ 2015-02-05 13:52 UTC (permalink / raw)
  To: netdev

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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] dsa: do not dereference non-existing routing table
  2015-02-05 13:52 [PATCH] dsa: do not dereference non-existing routing table Tobias Waldekranz
@ 2015-02-08  6:08 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2015-02-08  6:08 UTC (permalink / raw)
  To: tobias; +Cc: netdev

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.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-02-08  6:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-05 13:52 [PATCH] dsa: do not dereference non-existing routing table Tobias Waldekranz
2015-02-08  6:08 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).