From: Tony Nguyen <anthony.l.nguyen@intel.com>
To: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com,
edumazet@google.com, andrew+netdev@lunn.ch,
netdev@vger.kernel.org
Cc: Agalakov Daniil <ade@amicon.ru>,
anthony.l.nguyen@intel.com, jacob.e.keller@intel.com,
Iskhakov Daniil <dish@amicon.ru>
Subject: [PATCH net-next 12/15] e1000: limit endianness conversion to boundary words
Date: Tue, 9 Jun 2026 14:35:53 -0700 [thread overview]
Message-ID: <20260609213559.178657-13-anthony.l.nguyen@intel.com> (raw)
In-Reply-To: <20260609213559.178657-1-anthony.l.nguyen@intel.com>
From: Agalakov Daniil <ade@amicon.ru>
[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@amicon.ru>
Signed-off-by: Iskhakov Daniil <dish@amicon.ru>
Signed-off-by: Agalakov Daniil <ade@amicon.ru>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
---
drivers/net/ethernet/intel/e1000/e1000_ethtool.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/intel/e1000/e1000_ethtool.c b/drivers/net/ethernet/intel/e1000/e1000_ethtool.c
index 4dcbeabb3ad2..c15ad95c63c1 100644
--- a/drivers/net/ethernet/intel/e1000/e1000_ethtool.c
+++ b/drivers/net/ethernet/intel/e1000/e1000_ethtool.c
@@ -499,6 +499,9 @@ static int e1000_set_eeprom(struct net_device *netdev,
if (ret_val)
goto out;
+ /* Device's eeprom is always little-endian, word addressable */
+ le16_to_cpus(&eeprom_buff[0]);
+
ptr++;
}
if ((eeprom->offset + eeprom->len) & 1) {
@@ -509,11 +512,10 @@ static int e1000_set_eeprom(struct net_device *netdev,
&eeprom_buff[last_word - first_word]);
if (ret_val)
goto out;
- }
- /* Device's eeprom is always little-endian, word addressable */
- for (i = 0; i < last_word - first_word + 1; i++)
- le16_to_cpus(&eeprom_buff[i]);
+ /* Device's eeprom is always little-endian, word addressable */
+ le16_to_cpus(&eeprom_buff[last_word - first_word]);
+ }
memcpy(ptr, bytes, eeprom->len);
--
2.47.1
next prev parent reply other threads:[~2026-06-09 21:36 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-09 21:35 [PATCH net-next 00/15][pull request] Intel Wired LAN Driver Updates 2026-06-09 (idpf, ice, i40e, iavf, ixgbe, igc, igb, e1000e, e1000) Tony Nguyen
2026-06-09 21:35 ` [PATCH net-next 01/15] idpf: Replace use of system_unbound_wq with system_dfl_wq Tony Nguyen
2026-06-09 21:35 ` [PATCH net-next 02/15] ice: remove redundant checks from PTP init Tony Nguyen
2026-06-09 21:35 ` [PATCH net-next 03/15] iavf: iavf_virtchnl_completion: drop duplicate ether_addr_equal() test Tony Nguyen
2026-06-09 21:35 ` [PATCH net-next 04/15] net/intel: Replace manual array size calculation with ARRAY_SIZE Tony Nguyen
2026-06-09 21:35 ` [PATCH net-next 05/15] ixgbe: e610: remove redundant assignment Tony Nguyen
2026-06-09 21:35 ` [PATCH net-next 06/15] igb: Retrieve Tx timestamp from BH workqueue Tony Nguyen
2026-06-12 9:57 ` Simon Horman
2026-06-09 21:35 ` [PATCH net-next 07/15] igb: use ktime_get_real helpers in igb_ptp_reset() Tony Nguyen
2026-06-09 21:35 ` [PATCH net-next 08/15] e1000e: use ktime_get_real_ns() in e1000e_systim_reset() Tony Nguyen
2026-06-09 21:35 ` [PATCH net-next 09/15] igb: use napi_schedule_irqoff() instead of napi_schedule() Tony Nguyen
2026-06-09 21:35 ` [PATCH net-next 10/15] igc: " Tony Nguyen
2026-06-09 21:35 ` [PATCH net-next 11/15] e1000e: Use __napi_schedule_irqoff() Tony Nguyen
2026-06-09 21:35 ` Tony Nguyen [this message]
2026-06-09 21:35 ` [PATCH net-next 13/15] e1000e: limit endianness conversion to boundary words Tony Nguyen
2026-06-09 21:35 ` [PATCH net-next 14/15] igb: fix typos in comments Tony Nguyen
2026-06-09 21:35 ` [PATCH net-next 15/15] igc: " Tony Nguyen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260609213559.178657-13-anthony.l.nguyen@intel.com \
--to=anthony.l.nguyen@intel.com \
--cc=ade@amicon.ru \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=dish@amicon.ru \
--cc=edumazet@google.com \
--cc=jacob.e.keller@intel.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox