Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1452765

[PATCH] net: thunderx: correct bound check in nic_config_loopback

From "Levin, Alexander" <alexander.levin@verizon.com>
Newsgroups linux.kernel
Subject [PATCH] net: thunderx: correct bound check in nic_config_loopback
Date 2016-07-31 05:00 +0200
Message-ID <s0P8R-2Ce-1@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


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@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

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH] net: thunderx: correct bound check in nic_config_loopback "Levin, Alexander" <alexander.levin@verizon.com> - 2016-07-31 05:00 +0200
  Re: [PATCH] net: thunderx: correct bound check in nic_config_loopback Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> - 2016-07-31 12:00 +0200
  Re: [PATCH] net: thunderx: correct bound check in nic_config_loopback Sunil Kovvuri <sunil.kovvuri@gmail.com> - 2016-07-31 18:50 +0200
    Re: [PATCH] net: thunderx: correct bound check in  nic_config_loopback "Levin, Alexander" <alexander.levin@verizon.com> - 2016-08-01 18:10 +0200
      Re: [PATCH] net: thunderx: correct bound check in nic_config_loopback Sunil Kovvuri <sunil.kovvuri@gmail.com> - 2016-08-02 13:50 +0200

csiph-web