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

2016-08-02 Thread Sunil Kovvuri
Yes, it's incorrect at other places as well. That went in the very early stages of development and didn't change it because that out of bounds issue will never happen as no of logical interfaces will never be morethan MAX_LMAC i.e 8, so max vf_id will be 7. But with addition of support for newer

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

2016-08-01 Thread Levin, Alexander
On 07/31/2016 12:41 PM, Sunil Kovvuri wrote: > Thanks for finding. > A much better fix would be, > > - if (lbk->vf_id > MAX_LMAC) > + if (lbk->vf_id >= nic->num_vf_en) > return -1; > > where 'num_vf_en' reflects the exact number of physical interfaces or > LMACs on the

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

2016-07-31 Thread Sunil Kovvuri
Thanks for finding. A much better fix would be, - if (lbk->vf_id > MAX_LMAC) + if (lbk->vf_id >= nic->num_vf_en) return -1; where 'num_vf_en' reflects the exact number of physical interfaces or LMACs on the system. Thanks, Sunil.

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

2016-07-31 Thread Sergei Shtylyov
Hello. On 7/31/2016 5:49 AM, Levin, Alexander wrote: Off by one in nic_config_loopback would access an invalid arrat variable when Array? vf id == MAX_LMAC. Signed-off-by: Sasha Levin [...] MBR, Sergei

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

2016-07-30 Thread Levin, Alexander
Off by one in nic_config_loopback would access an invalid arrat variable when vf id == MAX_LMAC. Signed-off-by: Sasha Levin --- 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/dri