From 4e968cacb873d8497e95075b749295297745f92d Mon Sep 17 00:00:00 2001 From: Xiao Wang Date: Sun, 5 May 2019 13:48:21 +0800 Subject: [PATCH] net/ice: fix EEPROM range check 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 Acked-by: Qi Zhang --- 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 7d23f5d54a..bbaa7cf393 100644 --- a/drivers/net/ice/ice_ethdev.c +++ b/drivers/net/ice/ice_ethdev.c @@ -3009,8 +3009,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.20.1