aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux
diff options
context:
space:
mode:
authorjuhosg <juhosg@3c298f89-4303-0410-b956-a3cf2f4a3e73>2012-11-25 16:23:02 +0000
committerjuhosg <juhosg@3c298f89-4303-0410-b956-a3cf2f4a3e73>2012-11-25 16:23:02 +0000
commit7931b6c13db572b93df431bf4e049303d4e7b72d (patch)
tree25c382d027d3806ad4eea0929744ccbf9f374d42 /target/linux
parent083c20ccde9d690c13b173e2f59c3d000f26c05b (diff)
downloadopenwrt-7931b6c13db572b93df431bf4e049303d4e7b72d.tar.gz
openwrt-7931b6c13db572b93df431bf4e049303d4e7b72d.zip
AA: generic: ar8216: fix port number check in 'ar8xxx_mib_work_func'
Backport of r34283. Also add a WARN_ON to 'ar8216_mib_fetch_port_stat' Signed-off-by: Gabor Juhos <juhosg@openwrt.org> git-svn-id: svn://svn.openwrt.org/openwrt/branches/attitude_adjustment@34371 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux')
-rw-r--r--target/linux/generic/files/drivers/net/phy/ar8216.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/target/linux/generic/files/drivers/net/phy/ar8216.c b/target/linux/generic/files/drivers/net/phy/ar8216.c
index 8fc1f4b37..6187d523a 100644
--- a/target/linux/generic/files/drivers/net/phy/ar8216.c
+++ b/target/linux/generic/files/drivers/net/phy/ar8216.c
@@ -425,6 +425,8 @@ ar8216_mib_fetch_port_stat(struct ar8216_priv *priv, int port, bool flush)
u64 *mib_stats;
int i;
+ WARN_ON(port >= priv->dev.ports);
+
lockdep_assert_held(&priv->mib_lock);
if (chip_is_ar8327(priv))
@@ -1710,7 +1712,7 @@ ar8xxx_mib_work_func(struct work_struct *work)
next_port:
priv->mib_next_port++;
- if (priv->mib_next_port > priv->dev.ports)
+ if (priv->mib_next_port >= priv->dev.ports)
priv->mib_next_port = 0;
mutex_unlock(&priv->mib_lock);