summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_subr.c
diff options
context:
space:
mode:
authorart <art@openbsd.org>2001-06-23 05:45:13 +0000
committerart <art@openbsd.org>2001-06-23 05:45:13 +0000
commita950bd2d0b1fa0b2ccc33b2f3160e8a5aa391fc5 (patch)
tree86d1adb1ccc0d22b821c431c168229d7fab222b4 /sys/kern/kern_subr.c
parentOnly mips uses cpu_set_init_frame (and it shouldn't) (diff)
downloadwireguard-openbsd-a950bd2d0b1fa0b2ccc33b2f3160e8a5aa391fc5.tar.xz
wireguard-openbsd-a950bd2d0b1fa0b2ccc33b2f3160e8a5aa391fc5.zip
Since malloc in hashinit can get M_NOWAIT flags, we should
check the return value.
Diffstat (limited to 'sys/kern/kern_subr.c')
-rw-r--r--sys/kern/kern_subr.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/sys/kern/kern_subr.c b/sys/kern/kern_subr.c
index 59550ac7940..4fd1742f18f 100644
--- a/sys/kern/kern_subr.c
+++ b/sys/kern/kern_subr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_subr.c,v 1.16 2000/09/07 19:21:30 art Exp $ */
+/* $OpenBSD: kern_subr.c,v 1.17 2001/06/23 05:45:13 art Exp $ */
/* $NetBSD: kern_subr.c,v 1.15 1996/04/09 17:21:56 ragge Exp $ */
/*
@@ -182,6 +182,8 @@ hashinit(elements, type, flags, hashmask)
continue;
hashsize >>= 1;
hashtbl = malloc((u_long)hashsize * sizeof(*hashtbl), type, flags);
+ if (hashtbl == NULL)
+ return NULL;
for (i = 0; i < hashsize; i++)
LIST_INIT(&hashtbl[i]);
*hashmask = hashsize - 1;