DPDK patches and discussions
 help / color / mirror / Atom feed
From: Xiao Wang <xiao.w.wang@intel.com>
To: wenzhuo.lu@intel.com
Cc: dev@dpdk.org, qiming.yang@intel.com, leyi.rong@intel.com,
	Xiao Wang <xiao.w.wang@intel.com>,
	stable@dpdk.org
Subject: [dpdk-dev] [PATCH] net/ice: fix EEPROM range check
Date: Sun,  5 May 2019 13:48:21 +0800	[thread overview]
Message-ID: <20190505054821.133639-1-xiao.w.wang@intel.com> (raw)
Message-ID: <20190505054821.lFt5Gb4h_xauqDGEFC06qSgDc1QuUAcyZB4cQgSAoio@z> (raw)

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 <xiao.w.wang@intel.com>
---
 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


             reply	other threads:[~2019-05-05  6:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-05  5:48 Xiao Wang [this message]
2019-05-05  5:48 ` Xiao Wang
2019-05-06  0:37 ` Zhang, Qi Z
2019-05-06  0:37   ` Zhang, Qi Z

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190505054821.133639-1-xiao.w.wang@intel.com \
    --to=xiao.w.wang@intel.com \
    --cc=dev@dpdk.org \
    --cc=leyi.rong@intel.com \
    --cc=qiming.yang@intel.com \
    --cc=stable@dpdk.org \
    --cc=wenzhuo.lu@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).