summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2001-10-10 20:43:50 +0000
committerjhb <jhb@FreeBSD.org>2001-10-10 20:43:50 +0000
commita410ffa472b8eb78e1564fb2de137e2daf28dae2 (patch)
tree18d54d7ccbfd2890542a65a38e01ff57ad937a8a /sys
parent33c3770bff2aa5b67301c544f2ee3f522052d736 (diff)
downloadFreeBSD-src-a410ffa472b8eb78e1564fb2de137e2daf28dae2.zip
FreeBSD-src-a410ffa472b8eb78e1564fb2de137e2daf28dae2.tar.gz
Malloc mutexes pre-zero'd as random garbage (including 0xdeadcode) my
trigget the check to make sure we don't initalize a mutex twice.
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/kern_lock.c2
-rw-r--r--sys/kern/subr_rman.c2
-rw-r--r--sys/net/bpf.c2
3 files changed, 3 insertions, 3 deletions
diff --git a/sys/kern/kern_lock.c b/sys/kern/kern_lock.c
index a2835c3..351643e 100644
--- a/sys/kern/kern_lock.c
+++ b/sys/kern/kern_lock.c
@@ -102,7 +102,7 @@ lockmgr_init(void *dummy __unused)
}
lock_mtx_array = (struct mtx *)malloc(sizeof(struct mtx) * lock_nmtx,
- M_CACHE, M_WAITOK);
+ M_CACHE, M_WAITOK | M_ZERO);
for (i = 0; i < lock_nmtx; i++)
mtx_init(&lock_mtx_array[i], "lockmgr interlock", MTX_DEF);
}
diff --git a/sys/kern/subr_rman.c b/sys/kern/subr_rman.c
index f9941da..1fbafd3 100644
--- a/sys/kern/subr_rman.c
+++ b/sys/kern/subr_rman.c
@@ -99,7 +99,7 @@ rman_init(struct rman *rm)
panic("implement RMAN_GAUGE");
TAILQ_INIT(&rm->rm_list);
- rm->rm_mtx = malloc(sizeof *rm->rm_mtx, M_RMAN, M_NOWAIT);
+ rm->rm_mtx = malloc(sizeof *rm->rm_mtx, M_RMAN, M_NOWAIT | M_ZERO);
if (rm->rm_mtx == 0)
return ENOMEM;
mtx_init(rm->rm_mtx, "rman", MTX_DEF);
diff --git a/sys/net/bpf.c b/sys/net/bpf.c
index 68e5308..90b4e28 100644
--- a/sys/net/bpf.c
+++ b/sys/net/bpf.c
@@ -1212,7 +1212,7 @@ bpfattach(ifp, dlt, hdrlen)
u_int dlt, hdrlen;
{
struct bpf_if *bp;
- bp = (struct bpf_if *)malloc(sizeof(*bp), M_BPF, M_NOWAIT);
+ bp = (struct bpf_if *)malloc(sizeof(*bp), M_BPF, M_NOWAIT | M_ZERO);
if (bp == 0)
panic("bpfattach");
OpenPOWER on IntegriCloud