From patchwork Wed Sep 16 13:07:45 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Remy Horton X-Patchwork-Id: 7042 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id 0CFB23787; Wed, 16 Sep 2015 15:07:50 +0200 (CEST) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id AB517377E for ; Wed, 16 Sep 2015 15:07:48 +0200 (CEST) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga103.fm.intel.com with ESMTP; 16 Sep 2015 06:07:46 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.17,539,1437462000"; d="scan'208";a="562800643" Received: from rhorton-mobl.ger.corp.intel.com (HELO localhost.ir.intel.com) ([163.33.230.2]) by FMSMGA003.fm.intel.com with ESMTP; 16 Sep 2015 06:07:46 -0700 From: Remy Horton To: dev@dpdk.org Date: Wed, 16 Sep 2015 14:07:45 +0100 Message-Id: <1442408865-7569-1-git-send-email-remy.horton@intel.com> X-Mailer: git-send-email 1.9.3 Subject: [dpdk-dev] [PATCH] ixgbe: Out-by-one in get/set EEPROM X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 --- 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);