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:
parent
8df10eb60f
commit
4e968cacb8
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user