[dpdk-dev] [PATCH] net/ice: fix EEPROM range check
Xiao Wang
xiao.w.wang at intel.com
Sun May 5 07:48:21 CEST 2019
The last word should not cross shadow RAM boundary.
Fixes: 68a1ab82ad74 ("net/ice: speed up to retrieve EEPROM")
Cc: stable at dpdk.org
Signed-off-by: Xiao Wang <xiao.w.wang at 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
More information about the dev
mailing list