git: e0267657f396 - main - e1000: Initialize helper variables in em_newitr()

From: Mark Johnston <markj_at_FreeBSD.org>
Date: Tue, 27 May 2025 17:54:35 UTC
The branch main has been updated by markj:

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

commit e0267657f3965a56d877075fe3d4d41b8afb2faf
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2025-05-27 16:31:06 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2025-05-27 17:33:39 +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
---
 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;