[lvc-project] [Intel-wired-lan] [PATCH net-next v3 2/2] e1000e: limit endianness conversion to boundary words
Dahan, AvigailX
avigailx.dahan at intel.com
Wed Apr 15 11:14:45 MSK 2026
On 01/04/2026 15:08, Agalakov Daniil wrote:
> [Why]
> In e1000_set_eeprom(), the eeprom_buff is allocated to hold a range of
> words. However, only the boundary words (the first and the last) are
> populated from the EEPROM if the write request is not word-aligned.
> The words in the middle of the buffer remain uninitialized because they
> are intended to be completely overwritten by the new data via memcpy().
>
> The previous implementation had a loop that performed le16_to_cpus()
> on the entire buffer. This resulted in endianness conversion being
> performed on uninitialized memory for all interior words.
>
> Fix this by converting the endianness only for the boundary words
> immediately after they are successfully read from the EEPROM.
>
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
>
> Co-developed-by: Iskhakov Daniil <dish at amicon.ru>
> Signed-off-by: Iskhakov Daniil <dish at amicon.ru>
> Signed-off-by: Agalakov Daniil <ade at amicon.ru>
> ---
> v3:
> - Reverted to v1's "check-then-convert" logic: the return value of
> e1000_read_nvm() is now checked before performing le16_to_cpus().
> - Removed the redundant full-buffer loops that caused double endianness
> conversion in v2.
>
> v2:
> - Split from the original bugfix series and targeted at 'net-next'.
> - Removed the Fixes: tag; limiting the conversion scope is an
> improvement to avoid unnecessary processing of uninitialized memory.
> - Improved commit description for clarity.
> - Note on e1000e: this driver already contains the necessary return
> value checks for EEPROM reads, so only the endianness conversion
> cleanup is included for e1000e.
>
> drivers/net/ethernet/intel/e1000e/ethtool.c | 19 ++++++++++++-------
> 1 file changed, 12 insertions(+), 7 deletions(-)
>
Tested-by: Avigail Dahan <avigailx.dahan at intel.com>
More information about the lvc-project
mailing list