Module Name: src Committed By: maxv Date: Thu Nov 15 10:37:26 UTC 2018
Modified Files: src/sys/kern: uipc_mbuf.c Log Message: Add KASSERTs. To generate a diff of this commit: cvs rdiff -u -r1.223 -r1.224 src/sys/kern/uipc_mbuf.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/kern/uipc_mbuf.c diff -u src/sys/kern/uipc_mbuf.c:1.223 src/sys/kern/uipc_mbuf.c:1.224 --- src/sys/kern/uipc_mbuf.c:1.223 Thu Nov 15 10:23:55 2018 +++ src/sys/kern/uipc_mbuf.c Thu Nov 15 10:37:26 2018 @@ -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 @@ m_tag_free(struct m_tag *t) 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 @@ m_tag_delete_chain(struct mbuf *m) { 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 @@ m_tag_find(const struct mbuf *m, int typ { 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 @@ m_tag_copy_chain(struct mbuf *to, struct { 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);