net/ice: fix EEPROM range check

The last word should not cross shadow RAM boundary.

Fixes: 68a1ab82ad ("net/ice: speed up to retrieve EEPROM")
Cc: stable@dpdk.org

Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
This commit is contained in:
Xiao Wang 2019-05-05 13:48:21 +08:00 committed by Ferruh Yigit
parent 8df10eb60f
commit 4e968cacb8

View File

@ -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;
}