Source-Changes-HG archive

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

[src/trunk]: src/sys/netipsec Add KASSERTs.



details:   https://anonhg.NetBSD.org/src/rev/bdd56de045be
branches:  trunk
changeset: 321309:bdd56de045be
user:      maxv <maxv%NetBSD.org@localhost>
date:      Sat Mar 10 17:52:50 2018 +0000

description:
Add KASSERTs.

diffstat:

 sys/netipsec/ipsec_mbuf.c |  8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diffs (43 lines):

diff -r 126ad5714588 -r bdd56de045be sys/netipsec/ipsec_mbuf.c
--- a/sys/netipsec/ipsec_mbuf.c Sat Mar 10 17:48:32 2018 +0000
+++ b/sys/netipsec/ipsec_mbuf.c Sat Mar 10 17:52:50 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ipsec_mbuf.c,v 1.21 2018/03/05 12:42:28 maxv Exp $     */
+/*     $NetBSD: ipsec_mbuf.c,v 1.22 2018/03/10 17:52:50 maxv Exp $     */
 
 /*
  * Copyright (c) 2002, 2003 Sam Leffler, Errno Consulting
@@ -29,7 +29,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ipsec_mbuf.c,v 1.21 2018/03/05 12:42:28 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ipsec_mbuf.c,v 1.22 2018/03/10 17:52:50 maxv Exp $");
 
 /*
  * IPsec-specific mbuf routines.
@@ -214,6 +214,7 @@
        unsigned remain;
 
        KASSERT(m0 != NULL);
+       KASSERT(m0->m_flags & M_PKTHDR);
        KASSERTMSG(hlen < MHLEN, "hlen too big: %u", hlen);
 
        for (m = m0; m && skip > m->m_len; m = m->m_next)
@@ -320,6 +321,7 @@
        if (__predict_false(n > MLEN)) {
                panic("%s: %d > MLEN", __func__, n);
        }
+       KASSERT(m->m_flags & M_PKTHDR);
 
        len = m->m_pkthdr.len;
        pad = n;
@@ -386,6 +388,8 @@
        struct mbuf *m1;
        int roff;
 
+       KASSERT(m->m_flags & M_PKTHDR);
+
        /* Find beginning of header */
        m1 = m_getptr(m, skip, &roff);
        if (m1 == NULL)



Home | Main Index | Thread Index | Old Index