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

Message ID 20200514070720.31734-1-chenxux.di@intel.com (mailing list archive)
State Accepted, archived
Delegated to: xiaolong ye
Headers
Series [v4] 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 success Travis build: passed
ci/Intel-compilation success Compilation OK
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-testing fail Testing issues

Commit Message

Chenxu Di May 14, 2020, 7:07 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>
---
v4:
-Updated the return value.
---
 drivers/net/i40e/i40e_ethdev.c | 6 ++++++
 1 file changed, 6 insertions(+)
  

Comments

Guo, Jia May 14, 2020, 9:07 a.m. UTC | #1
On 5/14/2020 3:07 PM, Chenxu Di wrote:
> 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>
> ---
> v4:
> -Updated the return value.
> ---
>   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..91dcd0ebf 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 -EINVAL;
> +
>   		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 -EINVAL;
> +
>   		for (j = I40E_FILTER_PCTYPE_INVALID + 1;
>   		     j < I40E_FILTER_PCTYPE_MAX; j++) {
>   			if (pf->adapter->pctypes_tbl[i] & (1ULL << j))
Reviewed-by: Jeff Guo <jia.guo@intel.com>
  
Xiaolong Ye May 15, 2020, 3:22 a.m. UTC | #2
Minor nit: 'issue' doesn't need to be mentioned in the commit title, since the
'fix' implies something is broken.

On 05/14, Chenxu Di wrote:
>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>
>---
>v4:
>-Updated the return value.
>---
> 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..91dcd0ebf 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 -EINVAL;
>+
> 		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 -EINVAL;
>+
> 		for (j = I40E_FILTER_PCTYPE_INVALID + 1;
> 		     j < I40E_FILTER_PCTYPE_MAX; j++) {
> 			if (pf->adapter->pctypes_tbl[i] & (1ULL << j))
>-- 
>2.17.1
>

Applied to dpdk-next-net-intel, Thanks.
  

Patch

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 749d85f54..91dcd0ebf 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 -EINVAL;
+
 		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 -EINVAL;
+
 		for (j = I40E_FILTER_PCTYPE_INVALID + 1;
 		     j < I40E_FILTER_PCTYPE_MAX; j++) {
 			if (pf->adapter->pctypes_tbl[i] & (1ULL << j))