Commit cd169d79 authored by Florian Fainelli's avatar Florian Fainelli Committed by David S. Miller
Browse files

net: dsa: b53: Bound check ARL searches



ARL searches are done by reading two ARL entries at a time, do not cap
the search at 1024 which would only limit us to half of the possible ARL
capacity, but use b53_max_arl_entries() instead which does the right
multiplication between bins and indexes.

Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent e3da4038
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1702,7 +1702,7 @@ int b53_fdb_dump(struct dsa_switch *ds, int port,
				break;
		}

	} while (count++ < 1024);
	} while (count++ < b53_max_arl_entries(priv) / 2);

	return 0;
}
+5 −0
Original line number Diff line number Diff line
@@ -213,6 +213,11 @@ static inline int is58xx(struct b53_device *dev)
#define B53_CPU_PORT_25	5
#define B53_CPU_PORT	8

static inline unsigned int b53_max_arl_entries(struct b53_device *dev)
{
	return dev->num_arl_buckets * dev->num_arl_bins;
}

struct b53_device *b53_switch_alloc(struct device *base,
				    const struct b53_io_ops *ops,
				    void *priv);