summaryrefslogtreecommitdiff
path: root/sys/kern
diff options
context:
space:
mode:
authorAlexander Bluhm <bluhm@cvs.openbsd.org>2018-09-10 16:14:09 +0000
committerAlexander Bluhm <bluhm@cvs.openbsd.org>2018-09-10 16:14:09 +0000
commita795c82e7ebab9c24979aa1bba558e6cdaaad380 (patch)
tree75bf4194e31d6056362ca86efedb8ddd92cc8819 /sys/kern
parent3cddae55ac33761e4dedbc232de3d7e3eeca3767 (diff)
Instead of calculating the mbuf packet header length here and there,
put the algorithm into a new function m_calchdrlen(). Also set an uninitialized m_len to 0 in NFS code. OK claudio@
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/uipc_mbuf.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/sys/kern/uipc_mbuf.c b/sys/kern/uipc_mbuf.c
index 2dda4b56292..4349c02e882 100644
--- a/sys/kern/uipc_mbuf.c
+++ b/sys/kern/uipc_mbuf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uipc_mbuf.c,v 1.257 2018/09/10 12:47:02 bluhm Exp $ */
+/* $OpenBSD: uipc_mbuf.c,v 1.258 2018/09/10 16:14:07 bluhm Exp $ */
/* $NetBSD: uipc_mbuf.c,v 1.15.4.1 1996/06/13 17:11:44 cgd Exp $ */
/*
@@ -327,6 +327,18 @@ m_resethdr(struct mbuf *m)
m->m_pkthdr.ph_loopcnt = loopcnt;
}
+void
+m_calchdrlen(struct mbuf *m)
+{
+ struct mbuf *n;
+ int plen = 0;
+
+ KASSERT(m->m_flags & M_PKTHDR);
+ for (n = m; n; n = n->m_next)
+ plen += n->m_len;
+ m->m_pkthdr.len = plen;
+}
+
struct mbuf *
m_getclr(int nowait, int type)
{