summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVisa Hankala <visa@cvs.openbsd.org>2020-02-09 14:09:09 +0000
committerVisa Hankala <visa@cvs.openbsd.org>2020-02-09 14:09:09 +0000
commitca4e9a8d143fb14af3eb323338a244731d54bcfc (patch)
tree529599c83a8aa7ca192d9aeb120041351b12f41f
parent7b258b04422b047546c873d8d674b4b94a5a36e6 (diff)
Zero struct knote on allocation. This makes the code less prone
to errors. OK deraadt@, cheloha@, anton@
-rw-r--r--sys/kern/kern_event.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/kern/kern_event.c b/sys/kern/kern_event.c
index 0e3e48452c8..8c42b479251 100644
--- a/sys/kern/kern_event.c
+++ b/sys/kern/kern_event.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_event.c,v 1.122 2020/02/05 17:03:13 visa Exp $ */
+/* $OpenBSD: kern_event.c,v 1.123 2020/02/09 14:09:08 visa Exp $ */
/*-
* Copyright (c) 1999,2000,2001 Jonathan Lemon <jlemon@FreeBSD.org>
@@ -686,7 +686,7 @@ kqueue_register(struct kqueue *kq, struct kevent *kev, struct proc *p)
}
if (kev->flags & EV_ADD)
- newkn = pool_get(&knote_pool, PR_WAITOK);
+ newkn = pool_get(&knote_pool, PR_WAITOK | PR_ZERO);
again:
if (fops->f_isfd) {