git: 0fc30789dff0 - main - e1000: fix NVM loop bounds and pointer access

From: Kevin Bowling <kbowling_at_FreeBSD.org>
Date: Tue, 11 Aug 2026 18:48:19 UTC
The branch main has been updated by kbowling:

URL: https://cgit.FreeBSD.org/src/commit/?id=0fc30789dff08d62c5c830e9aa8c5a0ca9080ad9

commit 0fc30789dff08d62c5c830e9aa8c5a0ca9080ad9
Author:     Menachem Fogel <menachem.fogel@intel.com>
AuthorDate: 2026-05-20 12:52:44 +0000
Commit:     Kevin Bowling <kbowling@FreeBSD.org>
CommitDate: 2026-08-11 18:47:58 +0000

    e1000: fix NVM loop bounds and pointer access
    
    DPDK commit message
    
    net/e1000/base: fix NVM loop bounds and pointer access
    
    Improve the NVM checksum routines by ensuring loop bounds are compared
    at the correct integer width. Use array indexing instead of explicit
    pointer arithmetic.
    
    Fixes: af75078fece3 ("first public release")
    Cc: stable@dpdk.org
    
    Signed-off-by: Menachem Fogel <menachem.fogel@intel.com>
    Signed-off-by: Dima Ruinskiy <dima.ruinskiy@intel.com>
    Signed-off-by: Ciara Loftus <ciara.loftus@intel.com>
    Acked-by: Bruce Richardson <bruce.richardson@intel.com>
    
    Obtained from:  DPDK (39fba42d04)
    MFC after:      2 weeks
---
 sys/dev/e1000/e1000_82575.c  | 4 ++--
 sys/dev/e1000/e1000_manage.c | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/sys/dev/e1000/e1000_82575.c b/sys/dev/e1000/e1000_82575.c
index 47b8006314f8..d0aebbce74d8 100644
--- a/sys/dev/e1000/e1000_82575.c
+++ b/sys/dev/e1000/e1000_82575.c
@@ -2348,7 +2348,7 @@ s32 e1000_validate_nvm_checksum_with_offset(struct e1000_hw *hw, u16 offset)
 
 	DEBUGFUNC("e1000_validate_nvm_checksum_with_offset");
 
-	for (i = offset; i < ((NVM_CHECKSUM_REG + offset) + 1); i++) {
+	for (i = offset; i < (u16)((NVM_CHECKSUM_REG + offset) + 1); i++) {
 		ret_val = hw->nvm.ops.read(hw, i, 1, &nvm_data);
 		if (ret_val) {
 			DEBUGOUT("NVM Read Error\n");
@@ -2385,7 +2385,7 @@ s32 e1000_update_nvm_checksum_with_offset(struct e1000_hw *hw, u16 offset)
 
 	DEBUGFUNC("e1000_update_nvm_checksum_with_offset");
 
-	for (i = offset; i < (NVM_CHECKSUM_REG + offset); i++) {
+	for (i = offset; i < (u16)(NVM_CHECKSUM_REG + offset); i++) {
 		ret_val = hw->nvm.ops.read(hw, i, 1, &nvm_data);
 		if (ret_val) {
 			DEBUGOUT("NVM Read Error while updating checksum.\n");
diff --git a/sys/dev/e1000/e1000_manage.c b/sys/dev/e1000/e1000_manage.c
index 96a7a3dde8a9..2cbf5af0af1a 100644
--- a/sys/dev/e1000/e1000_manage.c
+++ b/sys/dev/e1000/e1000_manage.c
@@ -159,7 +159,7 @@ bool e1000_enable_tx_pkt_filtering_generic(struct e1000_hw *hw)
 	len    = E1000_MNG_DHCP_COOKIE_LENGTH >> 2;
 	offset = E1000_MNG_DHCP_COOKIE_OFFSET >> 2;
 	for (i = 0; i < len; i++)
-		*(buffer + i) = E1000_READ_REG_ARRAY_DWORD(hw, E1000_HOST_IF,
+		buffer[i] = E1000_READ_REG_ARRAY_DWORD(hw, E1000_HOST_IF,
 							   offset + i);
 	hdr_csum = hdr->checksum;
 	hdr->checksum = 0;
@@ -203,7 +203,7 @@ s32 e1000_mng_write_cmd_header_generic(struct e1000_hw *hw,
 	/* Write the relevant command block into the ram area. */
 	for (i = 0; i < length; i++) {
 		E1000_WRITE_REG_ARRAY_DWORD(hw, E1000_HOST_IF, i,
-					    *((u32 *) hdr + i));
+					    ((u32 *)hdr)[i]);
 		E1000_WRITE_FLUSH(hw);
 	}