Source-Changes-HG archive

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

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



details:   https://anonhg.NetBSD.org/src/rev/d3f1cac59fcf
branches:  trunk
changeset: 994614:d3f1cac59fcf
user:      maxv <maxv%NetBSD.org@localhost>
date:      Thu Nov 15 10:37:26 2018 +0000

description:
Add KASSERTs.

diffstat:

 sys/kern/uipc_mbuf.c |  12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diffs (60 lines):

diff -r 6263f5720ecb -r d3f1cac59fcf sys/kern/uipc_mbuf.c
--- a/sys/kern/uipc_mbuf.c      Thu Nov 15 10:34:21 2018 +0000
+++ b/sys/kern/uipc_mbuf.c      Thu Nov 15 10:37:26 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uipc_mbuf.c,v 1.223 2018/11/15 10:23:55 maxv Exp $     */
+/*     $NetBSD: uipc_mbuf.c,v 1.224 2018/11/15 10:37:26 maxv Exp $     */
 
 /*
  * Copyright (c) 1999, 2001 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uipc_mbuf.c,v 1.223 2018/11/15 10:23:55 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_mbuf.c,v 1.224 2018/11/15 10:37:26 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_mbuftrace.h"
@@ -2242,12 +2242,14 @@
 void
 m_tag_prepend(struct mbuf *m, struct m_tag *t)
 {
+       KASSERT((m->m_flags & M_PKTHDR) != 0);
        SLIST_INSERT_HEAD(&m->m_pkthdr.tags, t, m_tag_link);
 }
 
 void
 m_tag_unlink(struct mbuf *m, struct m_tag *t)
 {
+       KASSERT((m->m_flags & M_PKTHDR) != 0);
        SLIST_REMOVE(&m->m_pkthdr.tags, t, m_tag, m_tag_link);
 }
 
@@ -2263,6 +2265,8 @@
 {
        struct m_tag *p, *q;
 
+       KASSERT((m->m_flags & M_PKTHDR) != 0);
+
        p = SLIST_FIRST(&m->m_pkthdr.tags);
        if (p == NULL)
                return;
@@ -2276,6 +2280,8 @@
 {
        struct m_tag *p;
 
+       KASSERT((m->m_flags & M_PKTHDR) != 0);
+
        p = SLIST_FIRST(&m->m_pkthdr.tags);
        while (p != NULL) {
                if (p->m_tag_id == type)
@@ -2308,6 +2314,8 @@
 {
        struct m_tag *p, *t, *tprev = NULL;
 
+       KASSERT((from->m_flags & M_PKTHDR) != 0);
+
        m_tag_delete_chain(to);
        SLIST_FOREACH(p, &from->m_pkthdr.tags, m_tag_link) {
                t = m_tag_copy(p);



Home | Main Index | Thread Index | Old Index