git: 4d65728d55a7 - stable/14 - ethernet: Fix logging of frame length
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 15 Apr 2024 04:02:02 UTC
The branch stable/14 has been updated by zlei: URL: https://cgit.FreeBSD.org/src/commit/?id=4d65728d55a754f2529ca2cfb87c9588146563d0 commit 4d65728d55a754f2529ca2cfb87c9588146563d0 Author: Zhenlei Huang <zlei@FreeBSD.org> AuthorDate: 2024-04-08 16:44:33 +0000 Commit: Zhenlei Huang <zlei@FreeBSD.org> CommitDate: 2024-04-15 04:00:37 +0000 ethernet: Fix logging of frame length Both the mbuf length and the total packet length are signed. While here, update a stall comment to reflect the current practice. Reviewed by: kp MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D42390 (cherry picked from commit e7102929bf4fea4bf22855d2d6031edf6c413608) --- sys/net/if_ethersubr.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c index 4a726831a3db..4d82bb0cfdca 100644 --- a/sys/net/if_ethersubr.c +++ b/sys/net/if_ethersubr.c @@ -536,10 +536,10 @@ ether_input_internal(struct ifnet *ifp, struct mbuf *m) return; } #endif - if (m->m_len < ETHER_HDR_LEN) { - /* XXX maybe should pullup? */ + if (__predict_false(m->m_len < ETHER_HDR_LEN)) { + /* Drivers should pullup and ensure the mbuf is valid */ if_printf(ifp, "discard frame w/o leading ethernet " - "header (len %u pkt len %u)\n", + "header (len %d pkt len %d)\n", m->m_len, m->m_pkthdr.len); if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); m_freem(m);