From adeec5d08a043614192f047a58012c603b54bb02 Mon Sep 17 00:00:00 2001 From: dhill Date: Sun, 9 Apr 2017 18:05:17 +0000 Subject: [PATCH] Convert some malloc(9) to mallocarray(9) ok deraadt@ --- sys/dev/wscons/wsemul_vt100.c | 10 +++++----- sys/dev/wscons/wsevent.c | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/sys/dev/wscons/wsemul_vt100.c b/sys/dev/wscons/wsemul_vt100.c index 7f7d2e90b6c..6d90d906583 100644 --- a/sys/dev/wscons/wsemul_vt100.c +++ b/sys/dev/wscons/wsemul_vt100.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wsemul_vt100.c,v 1.33 2015/08/28 00:03:53 deraadt Exp $ */ +/* $OpenBSD: wsemul_vt100.c,v 1.34 2017/04/09 18:05:17 dhill Exp $ */ /* $NetBSD: wsemul_vt100.c,v 1.13 2000/04/28 21:56:16 mycroft Exp $ */ /* @@ -222,10 +222,10 @@ wsemul_vt100_attach(int console, const struct wsscreen_descr *type, edp->dblwid = malloc(edp->nrows, M_DEVBUF, M_NOWAIT | M_ZERO); edp->dw = 0; edp->dcsarg = malloc(DCS_MAXLEN, M_DEVBUF, M_NOWAIT); - edp->isolatin1tab = malloc(128 * sizeof(u_int), M_DEVBUF, M_NOWAIT); - edp->decgraphtab = malloc(128 * sizeof(u_int), M_DEVBUF, M_NOWAIT); - edp->dectechtab = malloc(128 * sizeof(u_int), M_DEVBUF, M_NOWAIT); - edp->nrctab = malloc(128 * sizeof(u_int), M_DEVBUF, M_NOWAIT); + edp->isolatin1tab = mallocarray(128, sizeof(u_int), M_DEVBUF, M_NOWAIT); + edp->decgraphtab = mallocarray(128, sizeof(u_int), M_DEVBUF, M_NOWAIT); + edp->dectechtab = mallocarray(128, sizeof(u_int), M_DEVBUF, M_NOWAIT); + edp->nrctab = mallocarray(128, sizeof(u_int), M_DEVBUF, M_NOWAIT); vt100_initchartables(edp); wsemul_vt100_reset(edp); return (edp); diff --git a/sys/dev/wscons/wsevent.c b/sys/dev/wscons/wsevent.c index 7838dee8a4f..37bbeb66172 100644 --- a/sys/dev/wscons/wsevent.c +++ b/sys/dev/wscons/wsevent.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wsevent.c,v 1.15 2016/01/12 16:21:09 stefan Exp $ */ +/* $OpenBSD: wsevent.c,v 1.16 2017/04/09 18:05:17 dhill Exp $ */ /* $NetBSD: wsevent.c,v 1.16 2003/08/07 16:31:29 agc Exp $ */ /* @@ -109,7 +109,7 @@ wsevent_init(struct wseventvar *ev) return; } ev->get = ev->put = 0; - ev->q = malloc(WSEVENT_QSIZE * sizeof(struct wscons_event), + ev->q = mallocarray(WSEVENT_QSIZE, sizeof(struct wscons_event), M_DEVBUF, M_WAITOK | M_ZERO); } -- 2.20.1