diff options
| author | 2019-12-24 12:56:07 +0000 | |
|---|---|---|
| committer | 2019-12-24 12:56:07 +0000 | |
| commit | 6ce17bc767e4fe52a433bf623dce63126f27ca3a (patch) | |
| tree | 11fe90e70dd6dd816d51060ee90e0f90a8cbd97c /sys/kern/subr_log.c | |
| parent | simplify assertions (diff) | |
| download | wireguard-openbsd-6ce17bc767e4fe52a433bf623dce63126f27ca3a.tar.xz wireguard-openbsd-6ce17bc767e4fe52a433bf623dce63126f27ca3a.zip | |
The console buffer is allocated during startup. initconsbuf() is
only called from main(). There allocation must not fail, so better
use M_WAITOK and remove error handling. As it is not a temporary
buffer, M_TTYS is more appropriate.
OK deraadt@ mpi@
Diffstat (limited to 'sys/kern/subr_log.c')
| -rw-r--r-- | sys/kern/subr_log.c | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/sys/kern/subr_log.c b/sys/kern/subr_log.c index 5eb916c6d99..6f5d2be7b44 100644 --- a/sys/kern/subr_log.c +++ b/sys/kern/subr_log.c @@ -1,4 +1,4 @@ -/* $OpenBSD: subr_log.c,v 1.59 2019/10/24 03:31:49 visa Exp $ */ +/* $OpenBSD: subr_log.c,v 1.60 2019/12/24 12:56:07 bluhm Exp $ */ /* $NetBSD: subr_log.c,v 1.11 1996/03/30 22:24:44 christos Exp $ */ /* @@ -132,15 +132,10 @@ initmsgbuf(caddr_t buf, size_t bufsize) void initconsbuf(void) { - long new_bufs; - /* Set up a buffer to collect /dev/console output */ - consbufp = malloc(CONSBUFSIZE, M_TEMP, M_NOWAIT|M_ZERO); - if (consbufp) { - new_bufs = CONSBUFSIZE - offsetof(struct msgbuf, msg_bufc); - consbufp->msg_magic = MSG_MAGIC; - consbufp->msg_bufs = new_bufs; - } + consbufp = malloc(CONSBUFSIZE, M_TTYS, M_WAITOK | M_ZERO); + consbufp->msg_magic = MSG_MAGIC; + consbufp->msg_bufs = CONSBUFSIZE - offsetof(struct msgbuf, msg_bufc); } void |
