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 E3AC3A00C3; Thu, 14 May 2020 08:17:14 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id B5C0B1D43F; Thu, 14 May 2020 08:17:14 +0200 (CEST) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by dpdk.org (Postfix) with ESMTP id 0429F1D420 for ; Thu, 14 May 2020 08:17:12 +0200 (CEST) IronPort-SDR: x4g2x83LzVtGOs65oWeIFoNW+Ihj3UhGxD3wWiCpzm+nZEwRoaaj6A9jAI9ZXXaY9mS2jYfSSp g0JTmsGcWqWw== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 May 2020 23:17:11 -0700 IronPort-SDR: 9IVhEZPsc7510KIcX7y2JVS4TKi8bU3YOLD/kKX9Ub2Y2mudvCmjbapbCK9pT5ymn9Gf97dL/D rp4cplLO/0/w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,390,1583222400"; d="scan'208";a="287298600" Received: from jguo15x-mobl.ccr.corp.intel.com (HELO [10.67.68.162]) ([10.67.68.162]) by fmsmga004.fm.intel.com with ESMTP; 13 May 2020 23:17:10 -0700 To: "Di, ChenxuX" , "dev@dpdk.org" Cc: "Xing, Beilei" References: <20200507030928.42082-1-chenxux.di@intel.com> <20200513022645.37302-1-chenxux.di@intel.com> From: Jeff Guo Message-ID: <479b7e59-053c-1675-3b0d-b1990a42eca3@intel.com> Date: Thu, 14 May 2020 14:17:10 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Subject: Re: [dpdk-dev] [PATCH v3] 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" On 5/14/2020 9:16 AM, Di, ChenxuX wrote: > Hi, > > > >> -----Original Message----- >> From: Guo, Jia >> Sent: Wednesday, May 13, 2020 2:51 PM >> To: Di, ChenxuX ; dev@dpdk.org >> Cc: Xing, Beilei >> Subject: Re: [PATCH v3] net/i40e: fix out of bounds read issue >> >> hi, chenxu >> >> On 5/13/2020 10:26 AM, 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 >>> --- >>> 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; >>> + >> >> Should this function need to return none zero value and show error info out, or >> said should considerate "out of bound" as a configure failed. >> > It will just find the flow type and do the things. If not find the flow type, it just do nothing and return. i40e_rss_config_hash_function is return int value right, should it always return 0? Should the case of not finding be considerate as none-success config? >>> 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))