From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id 1840F2082; Sun, 5 May 2019 08:04:12 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 May 2019 23:04:12 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,431,1549958400"; d="scan'208";a="229488450" Received: from dpdk-xiao-1.sh.intel.com ([10.67.111.145]) by orsmga001.jf.intel.com with ESMTP; 04 May 2019 23:04:10 -0700 From: Xiao Wang To: wenzhuo.lu@intel.com Cc: dev@dpdk.org, qiming.yang@intel.com, leyi.rong@intel.com, Xiao Wang , stable@dpdk.org Date: Sun, 5 May 2019 13:48:21 +0800 Message-Id: <20190505054821.133639-1-xiao.w.wang@intel.com> X-Mailer: git-send-email 2.15.1 Subject: [dpdk-dev] [PATCH] net/ice: fix EEPROM range check 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: , X-List-Received-Date: Sun, 05 May 2019 06:04:13 -0000 The last word should not cross shadow RAM boundary. Fixes: 68a1ab82ad74 ("net/ice: speed up to retrieve EEPROM") Cc: stable@dpdk.org Signed-off-by: Xiao Wang --- drivers/net/ice/ice_ethdev.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c index 706632424..3d2f35bb0 100644 --- a/drivers/net/ice/ice_ethdev.c +++ b/drivers/net/ice/ice_ethdev.c @@ -3002,8 +3002,8 @@ ice_get_eeprom(struct rte_eth_dev *dev, last_word = (eeprom->offset + eeprom->length - 1) >> 1; nwords = last_word - first_word + 1; - if (first_word > hw->nvm.sr_words || - last_word > hw->nvm.sr_words) { + if (first_word >= hw->nvm.sr_words || + last_word >= hw->nvm.sr_words) { PMD_DRV_LOG(ERR, "Requested EEPROM bytes out of range."); return -EINVAL; } -- 2.15.1 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 29F2AA0096 for ; Sun, 5 May 2019 08:04:17 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id DACC82BB0; Sun, 5 May 2019 08:04:14 +0200 (CEST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id 1840F2082; Sun, 5 May 2019 08:04:12 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 May 2019 23:04:12 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,431,1549958400"; d="scan'208";a="229488450" Received: from dpdk-xiao-1.sh.intel.com ([10.67.111.145]) by orsmga001.jf.intel.com with ESMTP; 04 May 2019 23:04:10 -0700 From: Xiao Wang To: wenzhuo.lu@intel.com Cc: dev@dpdk.org, qiming.yang@intel.com, leyi.rong@intel.com, Xiao Wang , stable@dpdk.org Date: Sun, 5 May 2019 13:48:21 +0800 Message-Id: <20190505054821.133639-1-xiao.w.wang@intel.com> X-Mailer: git-send-email 2.15.1 Subject: [dpdk-dev] [PATCH] net/ice: fix EEPROM range check 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" Content-Type: text/plain; charset="UTF-8" Message-ID: <20190505054821.lFt5Gb4h_xauqDGEFC06qSgDc1QuUAcyZB4cQgSAoio@z> The last word should not cross shadow RAM boundary. Fixes: 68a1ab82ad74 ("net/ice: speed up to retrieve EEPROM") Cc: stable@dpdk.org Signed-off-by: Xiao Wang --- drivers/net/ice/ice_ethdev.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c index 706632424..3d2f35bb0 100644 --- a/drivers/net/ice/ice_ethdev.c +++ b/drivers/net/ice/ice_ethdev.c @@ -3002,8 +3002,8 @@ ice_get_eeprom(struct rte_eth_dev *dev, last_word = (eeprom->offset + eeprom->length - 1) >> 1; nwords = last_word - first_word + 1; - if (first_word > hw->nvm.sr_words || - last_word > hw->nvm.sr_words) { + if (first_word >= hw->nvm.sr_words || + last_word >= hw->nvm.sr_words) { PMD_DRV_LOG(ERR, "Requested EEPROM bytes out of range."); return -EINVAL; } -- 2.15.1