[v2] net/i40e: fix out of bounds read issue

Message ID 20200507094941.87470-1-chenxux.di@intel.com (mailing list archive)
State Superseded, archived
Delegated to: xiaolong ye
Headers
Series [v2] net/i40e: fix out of bounds read issue |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-nxp-Performance success Performance Testing PASS
ci/travis-robot warning Travis build: failed
ci/Intel-compilation fail Compilation issues
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-testing success Testing PASS

Commit Message

Chenxu Di May 7, 2020, 9:49 a.m. UTC
  This patch fixes (out-of-bounds read) coverity issue.

Coverity issue: 357699
Coverity issue: 357694
Fixes: feaae285b342 ("net/i40e: support hash configuration in RSS flow")

Signed-off-by: Chenxu Di <chenxux.di@intel.com>
---
 drivers/net/i40e/i40e_ethdev.c | 6 ++++++
 1 file changed, 6 insertions(+)
  

Comments

Qiming Yang May 8, 2020, 2:26 a.m. UTC | #1
Nacked by: Qiming Yang <Qiming.yang@intel.com>

> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Chenxu Di
> Sent: Thursday, May 7, 2020 17:50
> To: dev@dpdk.org
> Cc: Di, ChenxuX <chenxux.di@intel.com>
> Subject: [dpdk-dev] [PATCH v2] net/i40e: fix out of bounds read issue
> 
> This patch fixes (out-of-bounds read) coverity issue.
> 
> Coverity issue: 357699
> Coverity issue: 357694
> Fixes: feaae285b342 ("net/i40e: support hash configuration in RSS flow")
> 
> Signed-off-by: Chenxu Di <chenxux.di@intel.com>
> ---
>  drivers/net/i40e/i40e_ethdev.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
> index 749d85f54..c2d5c6835 100644
> --- a/drivers/net/i40e/i40e_ethdev.c
> +++ b/drivers/net/i40e/i40e_ethdev.c
> @@ -13179,6 +13179,9 @@ i40e_rss_config_hash_function(struct i40e_pf
> *pf,
>  				break;
>  		}
> 
> +		if (i == UINT64_BIT)
> +			return 0;
> +



>  		for (j = I40E_FILTER_PCTYPE_INVALID + 1;
>  		     j < I40E_FILTER_PCTYPE_MAX; j++) {
>  			if (pf->adapter->pctypes_tbl[i] & (1ULL << j)) @@ -
> 13311,6 +13314,9 @@ i40e_rss_clear_hash_function(struct i40e_pf *pf,
>  				break;
>  		}
> 
> +		if (i == UINT64_BIT)
> +			return 0;
> +
>  		for (j = I40E_FILTER_PCTYPE_INVALID + 1;
>  		     j < I40E_FILTER_PCTYPE_MAX; j++) {
>  			if (pf->adapter->pctypes_tbl[i] & (1ULL << j))
> --
> 2.17.1
  
Xiaolong Ye May 8, 2020, 2:36 a.m. UTC | #2
Hi, Qiming

On 05/08, Yang, Qiming wrote:
>Nacked by: Qiming Yang <Qiming.yang@intel.com>

Could you post the reason why you nack this patch?

Thanks,
Xiaolong

>
>> -----Original Message-----
>> From: dev <dev-bounces@dpdk.org> On Behalf Of Chenxu Di
>> Sent: Thursday, May 7, 2020 17:50
>> To: dev@dpdk.org
>> Cc: Di, ChenxuX <chenxux.di@intel.com>
>> Subject: [dpdk-dev] [PATCH v2] net/i40e: fix out of bounds read issue
>> 
>> This patch fixes (out-of-bounds read) coverity issue.
>> 
>> Coverity issue: 357699
>> Coverity issue: 357694
>> Fixes: feaae285b342 ("net/i40e: support hash configuration in RSS flow")
>> 
>> Signed-off-by: Chenxu Di <chenxux.di@intel.com>
>> ---
>>  drivers/net/i40e/i40e_ethdev.c | 6 ++++++
>>  1 file changed, 6 insertions(+)
>> 
>> diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
>> index 749d85f54..c2d5c6835 100644
>> --- a/drivers/net/i40e/i40e_ethdev.c
>> +++ b/drivers/net/i40e/i40e_ethdev.c
>> @@ -13179,6 +13179,9 @@ i40e_rss_config_hash_function(struct i40e_pf
>> *pf,
>>  				break;
>>  		}
>> 
>> +		if (i == UINT64_BIT)
>> +			return 0;
>> +
>
>
>
>>  		for (j = I40E_FILTER_PCTYPE_INVALID + 1;
>>  		     j < I40E_FILTER_PCTYPE_MAX; j++) {
>>  			if (pf->adapter->pctypes_tbl[i] & (1ULL << j)) @@ -
>> 13311,6 +13314,9 @@ i40e_rss_clear_hash_function(struct i40e_pf *pf,
>>  				break;
>>  		}
>> 
>> +		if (i == UINT64_BIT)
>> +			return 0;
>> +
>>  		for (j = I40E_FILTER_PCTYPE_INVALID + 1;
>>  		     j < I40E_FILTER_PCTYPE_MAX; j++) {
>>  			if (pf->adapter->pctypes_tbl[i] & (1ULL << j))
>> --
>> 2.17.1
>
  
Qiming Yang May 8, 2020, 2:54 a.m. UTC | #3
Hi, Xiaolong
I reviewed that function, it need rework, not only this coverity issue, the logical was wrong.

Qiming

> -----Original Message-----
> From: Ye, Xiaolong <xiaolong.ye@intel.com>
> Sent: Friday, May 8, 2020 10:36
> To: Yang, Qiming <qiming.yang@intel.com>
> Cc: Di, ChenxuX <chenxux.di@intel.com>; dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH v2] net/i40e: fix out of bounds read issue
> 
> Hi, Qiming
> 
> On 05/08, Yang, Qiming wrote:
> >Nacked by: Qiming Yang <Qiming.yang@intel.com>
> 
> Could you post the reason why you nack this patch?
> 
> Thanks,
> Xiaolong
> 
> >
> >> -----Original Message-----
> >> From: dev <dev-bounces@dpdk.org> On Behalf Of Chenxu Di
> >> Sent: Thursday, May 7, 2020 17:50
> >> To: dev@dpdk.org
> >> Cc: Di, ChenxuX <chenxux.di@intel.com>
> >> Subject: [dpdk-dev] [PATCH v2] net/i40e: fix out of bounds read issue
> >>
> >> This patch fixes (out-of-bounds read) coverity issue.
> >>
> >> Coverity issue: 357699
> >> Coverity issue: 357694
> >> Fixes: feaae285b342 ("net/i40e: support hash configuration in RSS
> >> flow")
> >>
> >> Signed-off-by: Chenxu Di <chenxux.di@intel.com>
> >> ---
> >>  drivers/net/i40e/i40e_ethdev.c | 6 ++++++
> >>  1 file changed, 6 insertions(+)
> >>
> >> diff --git a/drivers/net/i40e/i40e_ethdev.c
> >> b/drivers/net/i40e/i40e_ethdev.c index 749d85f54..c2d5c6835 100644
> >> --- a/drivers/net/i40e/i40e_ethdev.c
> >> +++ b/drivers/net/i40e/i40e_ethdev.c
> >> @@ -13179,6 +13179,9 @@ i40e_rss_config_hash_function(struct i40e_pf
> >> *pf,
> >>  				break;
> >>  		}
> >>
> >> +		if (i == UINT64_BIT)
> >> +			return 0;
> >> +
> >
> >
> >
> >>  		for (j = I40E_FILTER_PCTYPE_INVALID + 1;
> >>  		     j < I40E_FILTER_PCTYPE_MAX; j++) {
> >>  			if (pf->adapter->pctypes_tbl[i] & (1ULL << j)) @@ -
> >> 13311,6 +13314,9 @@ i40e_rss_clear_hash_function(struct i40e_pf *pf,
> >>  				break;
> >>  		}
> >>
> >> +		if (i == UINT64_BIT)
> >> +			return 0;
> >> +
> >>  		for (j = I40E_FILTER_PCTYPE_INVALID + 1;
> >>  		     j < I40E_FILTER_PCTYPE_MAX; j++) {
> >>  			if (pf->adapter->pctypes_tbl[i] & (1ULL << j))
> >> --
> >> 2.17.1
> >
  

Patch

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 749d85f54..c2d5c6835 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -13179,6 +13179,9 @@  i40e_rss_config_hash_function(struct i40e_pf *pf,
 				break;
 		}
 
+		if (i == UINT64_BIT)
+			return 0;
+
 		for (j = I40E_FILTER_PCTYPE_INVALID + 1;
 		     j < I40E_FILTER_PCTYPE_MAX; j++) {
 			if (pf->adapter->pctypes_tbl[i] & (1ULL << j))
@@ -13311,6 +13314,9 @@  i40e_rss_clear_hash_function(struct i40e_pf *pf,
 				break;
 		}
 
+		if (i == UINT64_BIT)
+			return 0;
+
 		for (j = I40E_FILTER_PCTYPE_INVALID + 1;
 		     j < I40E_FILTER_PCTYPE_MAX; j++) {
 			if (pf->adapter->pctypes_tbl[i] & (1ULL << j))