git: 7d12558904ca - main - pf: Make pf_test predict that m_len < sizeof(struct ip) is false

From: Kristof Provost <kp_at_FreeBSD.org>
Date: Tue, 20 Aug 2024 12:18:44 UTC
The branch main has been updated by kp:

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

commit 7d12558904ca5b6f830a4ba9f7b1f8ba119bc5e3
Author:     Igor Ostapenko <pm@igoro.pro>
AuthorDate: 2024-08-20 10:02:56 +0000
Commit:     Kristof Provost <kp@FreeBSD.org>
CommitDate: 2024-08-20 12:17:59 +0000

    pf: Make pf_test predict that m_len < sizeof(struct ip) is false
    
    Reviewed by:    kp
    Differential Revision:  https://reviews.freebsd.org/D46374
---
 sys/netpfil/pf/pf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c
index 9b1601ac0ee5..ad2dc2e707ed 100644
--- a/sys/netpfil/pf/pf.c
+++ b/sys/netpfil/pf/pf.c
@@ -8354,7 +8354,7 @@ pf_test(int dir, int pflags, struct ifnet *ifp, struct mbuf **m0,
 	pd.af = AF_INET;
 	pd.act.rtableid = -1;
 
-	if (m->m_len < sizeof(struct ip) &&
+	if (__predict_false(m->m_len < sizeof(struct ip)) &&
 	    (m = *m0 = m_pullup(*m0, sizeof(struct ip))) == NULL) {
 		DPFPRINTF(PF_DEBUG_URGENT,
 		    ("pf_test: m_len < sizeof(struct ip), pullup failed\n"));