diff options
author | David Hill <dhill@cvs.openbsd.org> | 2017-04-09 18:07:20 +0000 |
---|---|---|
committer | David Hill <dhill@cvs.openbsd.org> | 2017-04-09 18:07:20 +0000 |
commit | 64e95158b6af8db0a1bd900f3da075774b404b44 (patch) | |
tree | fa830d2ef5b807bf1b251ef6872d4eddf906010d /sys | |
parent | 9219cf01483b9b82f52d67a9e03ac7140f1031f9 (diff) |
Convert some malloc(9) to mallocarray(9)
ok deraadt@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/ic/aac.c | 4 | ||||
-rw-r--r-- | sys/dev/ic/adw.c | 4 | ||||
-rw-r--r-- | sys/dev/ic/ath.c | 4 |
3 files changed, 6 insertions, 6 deletions
diff --git a/sys/dev/ic/aac.c b/sys/dev/ic/aac.c index 84f6d7a2670..b6188b64e65 100644 --- a/sys/dev/ic/aac.c +++ b/sys/dev/ic/aac.c @@ -1,4 +1,4 @@ -/* $OpenBSD: aac.c,v 1.68 2017/04/08 02:57:24 deraadt Exp $ */ +/* $OpenBSD: aac.c,v 1.69 2017/04/09 18:07:19 dhill Exp $ */ /*- * Copyright (c) 2000 Michael Smith @@ -1277,7 +1277,7 @@ aac_init(struct aac_softc *sc) /* Allocate some FIBs and associated command structs */ TAILQ_INIT(&sc->aac_fibmap_tqh); - sc->aac_commands = malloc(AAC_MAX_FIBS * sizeof(struct aac_command), + sc->aac_commands = mallocarray(AAC_MAX_FIBS, sizeof(struct aac_command), M_DEVBUF, M_WAITOK | M_ZERO); while (sc->total_fibs < AAC_MAX_FIBS) { if (aac_alloc_commands(sc) != 0) diff --git a/sys/dev/ic/adw.c b/sys/dev/ic/adw.c index 491a1bd9159..baebe59b76a 100644 --- a/sys/dev/ic/adw.c +++ b/sys/dev/ic/adw.c @@ -1,4 +1,4 @@ -/* $OpenBSD: adw.c,v 1.52 2015/03/14 03:38:47 jsg Exp $ */ +/* $OpenBSD: adw.c,v 1.53 2017/04/09 18:07:19 dhill Exp $ */ /* $NetBSD: adw.c,v 1.23 2000/05/27 18:24:50 dante Exp $ */ /* @@ -144,7 +144,7 @@ adw_alloc_carriers(ADW_SOFTC *sc) * Allocate the control structure. */ sc->sc_control->carriers = - malloc(sizeof(ADW_CARRIER) * ADW_MAX_CARRIER, M_DEVBUF, + mallocarray(ADW_MAX_CARRIER, sizeof(ADW_CARRIER), M_DEVBUF, M_NOWAIT); if (sc->sc_control->carriers == NULL) return (ENOMEM); diff --git a/sys/dev/ic/ath.c b/sys/dev/ic/ath.c index 704eb5d50a3..3a0520da9f4 100644 --- a/sys/dev/ic/ath.c +++ b/sys/dev/ic/ath.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ath.c,v 1.112 2017/01/22 10:17:37 dlg Exp $ */ +/* $OpenBSD: ath.c,v 1.113 2017/04/09 18:07:19 dhill Exp $ */ /* $NetBSD: ath.c,v 1.37 2004/08/18 21:59:39 dyoung Exp $ */ /*- @@ -2973,7 +2973,7 @@ ath_getchannels(struct ath_softc *sc, HAL_BOOL outdoor, HAL_BOOL xchanmode) int i, ix, nchan; sc->sc_nchan = 0; - chans = malloc(IEEE80211_CHAN_MAX * sizeof(HAL_CHANNEL), + chans = mallocarray(IEEE80211_CHAN_MAX, sizeof(HAL_CHANNEL), M_TEMP, M_NOWAIT); if (chans == NULL) { printf("%s: unable to allocate channel table\n", ifp->if_xname); |