kernel - cleanup & assertions in mbuf code
authorMatthew Dillon <dillon@laptop2.(none)>
Sat, 11 Sep 2010 18:52:45 +0000 (11:52 -0700)
committerMatthew Dillon <dillon@laptop2.(none)>
Sat, 11 Sep 2010 18:52:45 +0000 (11:52 -0700)
* Assert the mbuf's next/nextpkt fields are NULL on allocation.

sys/kern/uipc_mbuf.c

index e0c8030..75120a2 100644 (file)
@@ -666,9 +666,11 @@ static void __inline
 updatestats(struct mbuf *m, int type)
 {
        struct globaldata *gd = mycpu;
-       m->m_type = type;
 
+       m->m_type = type;
        mbuftrack(m);
+       KKASSERT(m->m_next == NULL);
+       KKASSERT(m->m_nextpkt == NULL);
 
        atomic_add_long_nonlocked(&mbtypes[gd->gd_cpuid][type], 1);
        atomic_add_long_nonlocked(&mbstat[mycpu->gd_cpuid].m_mbufs, 1);