From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 7C1BFA00C5; Thu, 7 May 2020 11:57:07 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id AD7061DB84; Thu, 7 May 2020 11:57:06 +0200 (CEST) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by dpdk.org (Postfix) with ESMTP id 9637C1DB7A for ; Thu, 7 May 2020 11:57:04 +0200 (CEST) IronPort-SDR: oHsJe5RLmXrhyqsQuELcnXBJkR6TgwLMoAahoxAvDmQY7MZIRPjUrJufkD4p6hkHMopPKVVkdz RHr8Q5qYdS8w== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 May 2020 02:57:02 -0700 IronPort-SDR: 3Mf8n1n6g+1Rl3YKoyR1fiwJfcASJO2vKZfyihDsmvKA2RhklvnuoaNbtlnjchFJadababW55H 07FkfC44+qOQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,363,1583222400"; d="scan'208";a="295665710" Received: from intel.sh.intel.com ([10.239.255.18]) by fmsmga002.fm.intel.com with ESMTP; 07 May 2020 02:57:01 -0700 From: Chenxu Di To: dev@dpdk.org Cc: Chenxu Di Date: Thu, 7 May 2020 09:49:41 +0000 Message-Id: <20200507094941.87470-1-chenxux.di@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200507030928.42082-1-chenxux.di@intel.com> References: <20200507030928.42082-1-chenxux.di@intel.com> Subject: [dpdk-dev] [PATCH v2] net/i40e: fix out of bounds read issue X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 --- 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