aboutsummaryrefslogtreecommitdiffstats
path: root/target
diff options
context:
space:
mode:
authorAlexander Couzens <lynxis@fe80.eu>2017-06-11 12:43:24 +0200
committerAlexander Couzens <lynxis@fe80.eu>2017-06-11 14:22:44 +0200
commitd18cb142d5dcdf112095d593b60b8c16c74e986b (patch)
treea08e8c8018b0ba2ab31cc707beeb44787f7ec1b4 /target
parentfd952c7a83e5357f5dcab28c0bcaca756e27eaa0 (diff)
downloadupstream-d18cb142d5dcdf112095d593b60b8c16c74e986b.tar.gz
upstream-d18cb142d5dcdf112095d593b60b8c16c74e986b.tar.bz2
upstream-d18cb142d5dcdf112095d593b60b8c16c74e986b.zip
ar71xx/ag71xx_ar7240_get_port_link: fix off-by-one check on argument `port`
Found-by: Coverity Scan #1329901 Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
Diffstat (limited to 'target')
-rw-r--r--target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_ar7240.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_ar7240.c b/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_ar7240.c
index c5aed0d2db..e457acb50c 100644
--- a/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_ar7240.c
+++ b/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_ar7240.c
@@ -963,7 +963,7 @@ ar7240_get_port_link(struct switch_dev *dev, int port,
struct mii_bus *mii = as->mii_bus;
u32 status;
- if (port > AR7240_NUM_PORTS)
+ if (port >= AR7240_NUM_PORTS)
return -EINVAL;
status = ar7240sw_reg_read(mii, AR7240_REG_PORT_STATUS(port));
@@ -1000,7 +1000,7 @@ ar7240_get_port_stats(struct switch_dev *dev, int port,
{
struct ar7240sw *as = sw_to_ar7240(dev);
- if (port > AR7240_NUM_PORTS)
+ if (port >= AR7240_NUM_PORTS)
return -EINVAL;
ar7240sw_capture_stats(as);