Module Name:    src
Committed By:   martin
Date:           Tue Feb 16 05:44:14 UTC 2021

Modified Files:
        src/sys/netinet: if_arp.c

Log Message:
Undo previous backout: alignment is needed here.
The reason for the previous backout was a misunderstanding (POINTER_ALIGNED_P
was broken, but the assertion fired even after it got fixed).


To generate a diff of this commit:
cvs rdiff -u -r1.304 -r1.305 src/sys/netinet/if_arp.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/netinet/if_arp.c
diff -u src/sys/netinet/if_arp.c:1.304 src/sys/netinet/if_arp.c:1.305
--- src/sys/netinet/if_arp.c:1.304	Mon Feb 15 19:49:17 2021
+++ src/sys/netinet/if_arp.c	Tue Feb 16 05:44:13 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_arp.c,v 1.304 2021/02/15 19:49:17 christos Exp $	*/
+/*	$NetBSD: if_arp.c,v 1.305 2021/02/16 05:44:13 martin Exp $	*/
 
 /*
  * Copyright (c) 1998, 2000, 2008 The NetBSD Foundation, Inc.
@@ -68,7 +68,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.304 2021/02/15 19:49:17 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.305 2021/02/16 05:44:13 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -707,10 +707,9 @@ arpintr(void)
 		MCLAIM(m, &arpdomain.dom_mowner);
 		ARP_STATINC(ARP_STAT_RCVTOTAL);
 
-		if (__predict_false(m->m_len < sizeof(*ar))) {
-			if ((m = m_pullup(m, sizeof(*ar))) == NULL)
-				goto badlen;
-		}
+		if (m_get_aligned_hdr(&m, ARP_HDR_ALIGNMENT, sizeof(*ar),
+		    false) != 0)
+			goto badlen;
 		ar = mtod(m, struct arphdr *);
 		KASSERT(POINTER_ALIGNED_P(ar, ARP_HDR_ALIGNMENT));
 

Reply via email to