DPDK patches and discussions
 help / color / mirror / Atom feed
From: Remy Horton <remy.horton@intel.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH] ixgbe: Out-by-one in get/set EEPROM
Date: Wed, 16 Sep 2015 14:07:45 +0100	[thread overview]
Message-ID: <1442408865-7569-1-git-send-email-remy.horton@intel.com> (raw)

Incorrect operator in ixgbe_get_eeprom & ixgbe_set_eeprom prevents
last byte of EEPROM being read/written, and hence cannot be dumped
or updated in entirity using these functions.

Signed-off-by: Remy Horton <remy.horton@intel.com>
---
 drivers/net/ixgbe/ixgbe_ethdev.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index ec2918c..4a7ee3b 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -5444,8 +5444,8 @@ ixgbe_get_eeprom(struct rte_eth_dev *dev,
 
 	first = in_eeprom->offset >> 1;
 	length = in_eeprom->length >> 1;
-	if ((first >= hw->eeprom.word_size) ||
-	    ((first + length) >= hw->eeprom.word_size))
+	if ((first > hw->eeprom.word_size) ||
+	    ((first + length) > hw->eeprom.word_size))
 		return -EINVAL;
 
 	in_eeprom->magic = hw->vendor_id | (hw->device_id << 16);
@@ -5464,8 +5464,8 @@ ixgbe_set_eeprom(struct rte_eth_dev *dev,
 
 	first = in_eeprom->offset >> 1;
 	length = in_eeprom->length >> 1;
-	if ((first >= hw->eeprom.word_size) ||
-	    ((first + length) >= hw->eeprom.word_size))
+	if ((first > hw->eeprom.word_size) ||
+	    ((first + length) > hw->eeprom.word_size))
 		return -EINVAL;
 
 	in_eeprom->magic = hw->vendor_id | (hw->device_id << 16);
-- 
1.9.3

             reply	other threads:[~2015-09-16 13:07 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-16 13:07 Remy Horton [this message]
2015-09-16 13:23 ` Thomas Monjalon
2015-09-17  9:05 ` [dpdk-dev] [PATCH v2] ixgbe: fix access to last byte of EEPROM Remy Horton
2015-09-17 10:13   ` Thomas Monjalon
2015-09-17 13:47   ` [dpdk-dev] [PATCH v3] " Remy Horton
2015-09-21  9:13     ` Ananyev, Konstantin
2015-10-28 16:15       ` Thomas Monjalon

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=1442408865-7569-1-git-send-email-remy.horton@intel.com \
    --to=remy.horton@intel.com \
    --cc=dev@dpdk.org \
    /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).