[v1,19/22] net/ixgbe/base: prevent untrusted loop bound
Checks
Commit Message
From: Dawid Zielinski <dawid.zielinski@intel.com>
Added length check against EEPROM size in words to prevent untrusted
loop bound reported by static code analysis.
Signed-off-by: Dawid Zielinski <dawid.zielinski@intel.com>
---
drivers/net/ixgbe/base/ixgbe_common.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
@@ -675,7 +675,7 @@ s32 ixgbe_read_pba_string_generic(struct ixgbe_hw *hw, u8 *pba_num,
return ret_val;
}
- if (length == 0xFFFF || length == 0) {
+ if (length == 0xFFFF || length == 0 || length > hw->eeprom.word_size) {
DEBUGOUT("NVM PBA number section invalid length\n");
return IXGBE_ERR_PBA_SECTION;
}