git: 18dac500d86f - stable/14 - e1000: Initialize helper variables in em_newitr()

From: Mark Johnston <markj_at_FreeBSD.org>
Date: Fri, 20 Jun 2025 13:52:19 UTC
The branch stable/14 has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=18dac500d86f95c1a2399f2f3d94566e5a1e42c4

commit 18dac500d86f95c1a2399f2f3d94566e5a1e42c4
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2025-05-27 16:31:06 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2025-06-20 12:46:09 +0000

    e1000: Initialize helper variables in em_newitr()
    
    Due to races with the threaded transmit and receive paths, it's possible
    to have r/tx_bytes != 0 && r/tx_packets == 0, in which case the maximum
    byte count could be left uninitialized.  Initialize them to zero to
    handle this case.
    
    PR:             286819
    Reviewed by:    kbowling
    MFC after:      2 weeks
    Differential Revision:  https://reviews.freebsd.org/D50416
    
    (cherry picked from commit e0267657f3965a56d877075fe3d4d41b8afb2faf)
---
 sys/dev/e1000/if_em.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sys/dev/e1000/if_em.c b/sys/dev/e1000/if_em.c
index f49682285875..27500f936c25 100644
--- a/sys/dev/e1000/if_em.c
+++ b/sys/dev/e1000/if_em.c
@@ -1671,6 +1671,7 @@ em_newitr(struct e1000_softc *sc, struct em_rx_queue *que,
 			goto em_set_next_itr;
 		}
 
+		bytes = bytes_packets = 0;
 		/* Get largest values from the associated tx and rx ring */
 		if (txr->tx_bytes && txr->tx_packets) {
 			bytes = txr->tx_bytes;