Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/netinet Undo previous; POINTER_ALIGNED_P was broken.



details:   https://anonhg.NetBSD.org/src/rev/9da0551bd135
branches:  trunk
changeset: 952725:9da0551bd135
user:      christos <christos%NetBSD.org@localhost>
date:      Mon Feb 15 19:49:17 2021 +0000

description:
Undo previous; POINTER_ALIGNED_P was broken.

diffstat:

 sys/netinet/if_arp.c |  11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diffs (32 lines):

diff -r 9f2105647a58 -r 9da0551bd135 sys/netinet/if_arp.c
--- a/sys/netinet/if_arp.c      Mon Feb 15 19:46:53 2021 +0000
+++ b/sys/netinet/if_arp.c      Mon Feb 15 19:49:17 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_arp.c,v 1.303 2021/02/15 19:19:29 christos Exp $    */
+/*     $NetBSD: if_arp.c,v 1.304 2021/02/15 19:49:17 christos 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.303 2021/02/15 19:19:29 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.304 2021/02/15 19:49:17 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -707,9 +707,10 @@
                MCLAIM(m, &arpdomain.dom_mowner);
                ARP_STATINC(ARP_STAT_RCVTOTAL);
 
-               if (m_get_aligned_hdr(&m, ARP_HDR_ALIGNMENT, sizeof(*ar),
-                   false) != 0)
-                       goto badlen;
+               if (__predict_false(m->m_len < sizeof(*ar))) {
+                       if ((m = m_pullup(m, sizeof(*ar))) == NULL)
+                               goto badlen;
+               }
                ar = mtod(m, struct arphdr *);
                KASSERT(POINTER_ALIGNED_P(ar, ARP_HDR_ALIGNMENT));
 



Home | Main Index | Thread Index | Old Index