diff options
author | Gabor Juhos <juhosg@openwrt.org> | 2012-11-20 20:40:04 +0000 |
---|---|---|
committer | Gabor Juhos <juhosg@openwrt.org> | 2012-11-20 20:40:04 +0000 |
commit | 2a792f32b54e274ea6b536033c3f5bdc8a75cc33 (patch) | |
tree | 610a312b18791b8877052d10211e7a27f339e049 /target/linux | |
parent | 258b2f2dc226da2a69f89a19dc2d8795579c99c4 (diff) | |
download | mtk-20170518-2a792f32b54e274ea6b536033c3f5bdc8a75cc33.zip mtk-20170518-2a792f32b54e274ea6b536033c3f5bdc8a75cc33.tar.gz mtk-20170518-2a792f32b54e274ea6b536033c3f5bdc8a75cc33.tar.bz2 |
generic: ar8216: fix port number check in 'ar8xxx_mib_work_func'
Also add a WARN_ON to 'ar8216_mib_fetch_port_stat'
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
SVN-Revision: 34283
Diffstat (limited to 'target/linux')
-rw-r--r-- | target/linux/generic/files/drivers/net/phy/ar8216.c | 4 |
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 8fc1f4b..6187d52 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); |