[PATCH] net: thunderx: correct bound check in nic_config_loopback
Levin, Alexander
alexander.levin at verizon.com
Sat Jul 30 19:49:44 PDT 2016
Off by one in nic_config_loopback would access an invalid arrat variable when
vf id == MAX_LMAC.
Signed-off-by: Sasha Levin <alexander.levin at verizon.com>
---
drivers/net/ethernet/cavium/thunder/nic_main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/cavium/thunder/nic_main.c b/drivers/net/ethernet/cavium/thunder/nic_main.c
index 16ed203..a70f50d 100644
--- a/drivers/net/ethernet/cavium/thunder/nic_main.c
+++ b/drivers/net/ethernet/cavium/thunder/nic_main.c
@@ -615,7 +615,7 @@ static int nic_config_loopback(struct nicpf *nic, struct set_loopback *lbk)
{
int bgx_idx, lmac_idx;
- if (lbk->vf_id > MAX_LMAC)
+ if (lbk->vf_id >= MAX_LMAC)
return -1;
bgx_idx = NIC_GET_BGX_FROM_VF_LMAC_MAP(nic->vf_lmac_map[lbk->vf_id]);
--
2.7.4
More information about the linux-arm-kernel
mailing list