summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbluhm <bluhm@openbsd.org>2021-01-13 12:38:36 +0000
committerbluhm <bluhm@openbsd.org>2021-01-13 12:38:36 +0000
commit1284ddabfdfcf0255ede8ffeea5987ae5f911dfe (patch)
tree1d62a2838218982e7913bd257c229e6be97aa9cd
parentExtend prefix_evaluate() to also be used when withdrawing a prefix. (diff)
downloadwireguard-openbsd-1284ddabfdfcf0255ede8ffeea5987ae5f911dfe.tar.xz
wireguard-openbsd-1284ddabfdfcf0255ede8ffeea5987ae5f911dfe.zip
Convert mbuf type KDASSERT() to a proper KASSERT() in m_get(9).
Should prevent to use uninitialized value as bogus counter index. OK mvs@ claudio@ anton@
-rw-r--r--sys/kern/uipc_mbuf.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/kern/uipc_mbuf.c b/sys/kern/uipc_mbuf.c
index 578300fb924..21b1d7279be 100644
--- a/sys/kern/uipc_mbuf.c
+++ b/sys/kern/uipc_mbuf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uipc_mbuf.c,v 1.276 2020/12/12 11:48:54 jan Exp $ */
+/* $OpenBSD: uipc_mbuf.c,v 1.277 2021/01/13 12:38:36 bluhm Exp $ */
/* $NetBSD: uipc_mbuf.c,v 1.15.4.1 1996/06/13 17:11:44 cgd Exp $ */
/*
@@ -244,7 +244,7 @@ m_get(int nowait, int type)
uint64_t *counters;
int s;
- KDASSERT(type < MT_NTYPES);
+ KASSERT(type >= 0 && type < MT_NTYPES);
m = pool_get(&mbpool, nowait == M_WAIT ? PR_WAITOK : PR_NOWAIT);
if (m == NULL)
@@ -277,7 +277,7 @@ m_gethdr(int nowait, int type)
uint64_t *counters;
int s;
- KDASSERT(type < MT_NTYPES);
+ KASSERT(type >= 0 && type < MT_NTYPES);
m = pool_get(&mbpool, nowait == M_WAIT ? PR_WAITOK : PR_NOWAIT);
if (m == NULL)