Source-Changes-HG archive

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

[src/trunk]: src/sys/net replace the conditional m_pullup() on start of ether...



details:   https://anonhg.NetBSD.org/src/rev/d7f60513ebac
branches:  trunk
changeset: 1008587:d7f60513ebac
user:      jdolecek <jdolecek%NetBSD.org@localhost>
date:      Fri Mar 27 17:18:15 2020 +0000

description:
replace the conditional m_pullup() on start of ether_sw_offload_tx()
with a KASSERT(), to make it clear no mbuf manipulation is ever done here

diffstat:

 sys/net/ether_sw_offload.c |  10 +++-------
 1 files changed, 3 insertions(+), 7 deletions(-)

diffs (31 lines):

diff -r e2cd5e7f73ff -r d7f60513ebac sys/net/ether_sw_offload.c
--- a/sys/net/ether_sw_offload.c        Fri Mar 27 16:47:00 2020 +0000
+++ b/sys/net/ether_sw_offload.c        Fri Mar 27 17:18:15 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ether_sw_offload.c,v 1.6 2018/12/15 07:38:58 rin Exp $ */
+/*     $NetBSD: ether_sw_offload.c,v 1.7 2020/03/27 17:18:15 jdolecek Exp $    */
 
 /*
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
 #endif
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ether_sw_offload.c,v 1.6 2018/12/15 07:38:58 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ether_sw_offload.c,v 1.7 2020/03/27 17:18:15 jdolecek Exp $");
 
 #include <sys/param.h>
 #include <sys/types.h>
@@ -96,11 +96,7 @@
                goto quit;
 
        KASSERT(m->m_pkthdr.len >= sizeof(*ep));
-       if (m->m_len < sizeof(*ep)) {
-               m = m_pullup(m, sizeof(*ep));
-               if (m == NULL)
-                       return NULL;
-       }
+       KASSERT(m->m_len >= sizeof(*ep));
        ep = mtod(m, struct ether_header *);
        switch (type = ntohs(ep->ether_type)) {
        case ETHERTYPE_IP:



Home | Main Index | Thread Index | Old Index