aboutsummaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
Diffstat (limited to 'sys')
-rw-r--r--sys/amd64/amd64/bpf_jit_machdep.c2
-rw-r--r--sys/arm/xscale/ixp425/if_npe.c3
-rw-r--r--sys/arm64/arm64/busdma_bounce.c4
-rw-r--r--sys/cam/cam_queue.c2
-rw-r--r--sys/cam/ctl/ctl_frontend.c4
-rw-r--r--sys/compat/ndis/subr_ndis.c2
-rw-r--r--sys/dev/aacraid/aacraid.c2
-rw-r--r--sys/dev/advansys/advansys.c2
-rw-r--r--sys/dev/ath/if_ath_rx_edma.c5
-rw-r--r--sys/dev/beri/virtio/virtio.c2
-rw-r--r--sys/dev/bnxt/if_bnxt.c19
-rw-r--r--sys/dev/bwn/if_bwn.c4
-rw-r--r--sys/dev/bwn/if_bwn_phy_lp.c2
-rw-r--r--sys/dev/ciss/ciss.c10
-rw-r--r--sys/dev/cxgbe/crypto/t4_crypto.c2
-rw-r--r--sys/dev/e1000/if_em.c13
-rw-r--r--sys/dev/esp/ncr53c9x.c2
-rw-r--r--sys/dev/fb/splash.c4
-rw-r--r--sys/dev/gpio/gpiobus.c6
-rw-r--r--sys/dev/if_ndis/if_ndis.c4
-rw-r--r--sys/dev/iwi/if_iwi.c4
-rw-r--r--sys/dev/ixl/if_ixlv.c4
-rw-r--r--sys/dev/ixl/ixl_pf_iov.c4
-rw-r--r--sys/dev/ixl/ixl_pf_main.c9
-rw-r--r--sys/dev/kbd/kbd.c7
-rw-r--r--sys/dev/liquidio/base/lio_request_manager.c2
-rw-r--r--sys/dev/liquidio/lio_main.c12
-rw-r--r--sys/dev/mpr/mpr.c2
-rw-r--r--sys/dev/mpr/mpr_mapping.c22
-rw-r--r--sys/dev/mps/mps.c4
-rw-r--r--sys/dev/mps/mps_mapping.c20
-rw-r--r--sys/dev/mpt/mpt_cam.c6
-rw-r--r--sys/dev/mrsas/mrsas.c3
-rw-r--r--sys/dev/mxge/if_mxge.c15
-rw-r--r--sys/dev/netmap/if_ptnet.c2
-rw-r--r--sys/dev/nvme/nvme_ns.c3
-rw-r--r--sys/dev/pst/pst-iop.c2
-rw-r--r--sys/dev/ral/rt2560.c6
-rw-r--r--sys/dev/ral/rt2661.c4
-rw-r--r--sys/dev/rp/rp.c3
-rw-r--r--sys/dev/rp/rp_isa.c6
-rw-r--r--sys/dev/rp/rp_pci.c6
-rw-r--r--sys/dev/sound/midi/midi.c5
-rw-r--r--sys/dev/sound/pci/hda/hdaa.c16
-rw-r--r--sys/dev/syscons/fire/fire_saver.c2
-rw-r--r--sys/dev/virtio/console/virtio_console.c10
-rw-r--r--sys/dev/virtio/mmio/virtio_mmio.c2
-rw-r--r--sys/dev/virtio/network/if_vtnet.c7
-rw-r--r--sys/dev/virtio/pci/virtio_pci.c4
-rw-r--r--sys/dev/vmware/vmxnet3/if_vmx.c12
-rw-r--r--sys/dev/vnic/nicvf_queues.c2
-rw-r--r--sys/dev/xen/blkback/blkback.c6
-rw-r--r--sys/dev/xen/blkfront/blkfront.c9
-rw-r--r--sys/fs/nfsclient/nfs_clvnops.c2
-rw-r--r--sys/geom/uzip/g_uzip_zlib.c2
-rw-r--r--sys/gnu/dev/bwn/phy_n/if_bwn_phy_n_core.c5
-rw-r--r--sys/i386/i386/bpf_jit_machdep.c2
-rw-r--r--sys/i386/i386/k6_mem.c2
-rw-r--r--sys/kern/init_main.c2
-rw-r--r--sys/kern/kern_cpu.c4
-rw-r--r--sys/kern/kern_ctf.c2
-rw-r--r--sys/kern/kern_pmc.c3
-rw-r--r--sys/kern/subr_bus.c6
-rw-r--r--sys/kern/subr_taskqueue.c4
-rw-r--r--sys/kern/subr_vmem.c2
-rw-r--r--sys/mips/mips/busdma_machdep.c15
-rw-r--r--sys/mips/nlm/dev/sec/nlmrsa.c7
-rw-r--r--sys/net/if_vlan.c2
-rw-r--r--sys/net/iflib.c37
-rw-r--r--sys/netgraph/ng_bridge.c2
-rw-r--r--sys/netgraph/ng_deflate.c2
-rw-r--r--sys/netgraph/ng_parse.c3
-rw-r--r--sys/netinet6/in6_jail.c4
-rw-r--r--sys/powerpc/pseries/phyp_vscsi.c4
-rw-r--r--sys/x86/cpufreq/est.c2
75 files changed, 204 insertions, 225 deletions
diff --git a/sys/amd64/amd64/bpf_jit_machdep.c b/sys/amd64/amd64/bpf_jit_machdep.c
index 646c6f39b8cd..8d4ddaa24135 100644
--- a/sys/amd64/amd64/bpf_jit_machdep.c
+++ b/sys/amd64/amd64/bpf_jit_machdep.c
@@ -186,7 +186,7 @@ bpf_jit_compile(struct bpf_insn *prog, u_int nins, size_t *size)
/* Allocate the reference table for the jumps. */
if (fjmp) {
#ifdef _KERNEL
- stream.refs = mallocarray(nins + 1, sizeof(u_int), M_BPFJIT,
+ stream.refs = malloc((nins + 1) * sizeof(u_int), M_BPFJIT,
M_NOWAIT | M_ZERO);
#else
stream.refs = calloc(nins + 1, sizeof(u_int));
diff --git a/sys/arm/xscale/ixp425/if_npe.c b/sys/arm/xscale/ixp425/if_npe.c
index c5c6033f01b7..d797154ee1d4 100644
--- a/sys/arm/xscale/ixp425/if_npe.c
+++ b/sys/arm/xscale/ixp425/if_npe.c
@@ -515,8 +515,7 @@ npe_dma_setup(struct npe_softc *sc, struct npedma *dma,
return error;
}
/* XXX M_TEMP */
- dma->buf = mallocarray(nbuf, sizeof(struct npebuf), M_TEMP,
- M_NOWAIT | M_ZERO);
+ dma->buf = malloc(nbuf * sizeof(struct npebuf), M_TEMP, M_NOWAIT | M_ZERO);
if (dma->buf == NULL) {
device_printf(sc->sc_dev,
"unable to allocate memory for %s s/w buffers\n",
diff --git a/sys/arm64/arm64/busdma_bounce.c b/sys/arm64/arm64/busdma_bounce.c
index 9b6d944bd33d..31eaf05370b6 100644
--- a/sys/arm64/arm64/busdma_bounce.c
+++ b/sys/arm64/arm64/busdma_bounce.c
@@ -302,8 +302,8 @@ bounce_bus_dmamap_create(bus_dma_tag_t dmat, int flags, bus_dmamap_t *mapp)
error = 0;
if (dmat->segments == NULL) {
- dmat->segments = (bus_dma_segment_t *)mallocarray(
- dmat->common.nsegments, sizeof(bus_dma_segment_t),
+ dmat->segments = (bus_dma_segment_t *)malloc(
+ sizeof(bus_dma_segment_t) * dmat->common.nsegments,
M_DEVBUF, M_NOWAIT);
if (dmat->segments == NULL) {
CTR3(KTR_BUSDMA, "%s: tag %p error %d",
diff --git a/sys/cam/cam_queue.c b/sys/cam/cam_queue.c
index 8cbe7fba06c0..a700195b819f 100644
--- a/sys/cam/cam_queue.c
+++ b/sys/cam/cam_queue.c
@@ -126,7 +126,7 @@ camq_resize(struct camq *queue, int new_size)
KASSERT(new_size >= queue->entries, ("camq_resize: "
"New queue size can't accommodate queued entries (%d < %d).",
new_size, queue->entries));
- new_array = (cam_pinfo **)mallocarray(new_size, sizeof(cam_pinfo *),
+ new_array = (cam_pinfo **)malloc(new_size * sizeof(cam_pinfo *),
M_CAMQ, M_NOWAIT);
if (new_array == NULL) {
/* Couldn't satisfy request */
diff --git a/sys/cam/ctl/ctl_frontend.c b/sys/cam/ctl/ctl_frontend.c
index 9b22198174a1..9a206d0c1423 100644
--- a/sys/cam/ctl/ctl_frontend.c
+++ b/sys/cam/ctl/ctl_frontend.c
@@ -172,8 +172,8 @@ ctl_port_register(struct ctl_port *port)
* Initialize the initiator and portname mappings
*/
port->max_initiators = CTL_MAX_INIT_PER_PORT;
- port->wwpn_iid = mallocarray(port->max_initiators,
- sizeof(*port->wwpn_iid), M_CTL, M_NOWAIT | M_ZERO);
+ port->wwpn_iid = malloc(sizeof(*port->wwpn_iid) * port->max_initiators,
+ M_CTL, M_NOWAIT | M_ZERO);
if (port->wwpn_iid == NULL) {
retval = ENOMEM;
goto error;
diff --git a/sys/compat/ndis/subr_ndis.c b/sys/compat/ndis/subr_ndis.c
index 871b5184e2c4..e1ba8cc12cd6 100644
--- a/sys/compat/ndis/subr_ndis.c
+++ b/sys/compat/ndis/subr_ndis.c
@@ -1351,7 +1351,7 @@ NdisMAllocateMapRegisters(ndis_handle adapter, uint32_t dmachannel,
block = (ndis_miniport_block *)adapter;
sc = device_get_softc(block->nmb_physdeviceobj->do_devext);
- sc->ndis_mmaps = mallocarray(physmapneeded, sizeof(bus_dmamap_t),
+ sc->ndis_mmaps = malloc(sizeof(bus_dmamap_t) * physmapneeded,
M_DEVBUF, M_NOWAIT|M_ZERO);
if (sc->ndis_mmaps == NULL)
diff --git a/sys/dev/aacraid/aacraid.c b/sys/dev/aacraid/aacraid.c
index 3a1054f9c663..920dbc6df930 100644
--- a/sys/dev/aacraid/aacraid.c
+++ b/sys/dev/aacraid/aacraid.c
@@ -1458,7 +1458,7 @@ aac_convert_sgraw2(struct aac_softc *sc, struct aac_raw_io2 *raw,
int i, j, pos;
u_int32_t addr_low;
- sge = mallocarray(nseg_new, sizeof(struct aac_sge_ieee1212),
+ sge = malloc(nseg_new * sizeof(struct aac_sge_ieee1212),
M_AACRAIDBUF, M_NOWAIT|M_ZERO);
if (sge == NULL)
return nseg;
diff --git a/sys/dev/advansys/advansys.c b/sys/dev/advansys/advansys.c
index 8be56fb3cb4e..bb6bffeb0758 100644
--- a/sys/dev/advansys/advansys.c
+++ b/sys/dev/advansys/advansys.c
@@ -1255,7 +1255,7 @@ adv_attach(adv)
* a transaction and use it for mapping the queue to the
* upper level SCSI transaction it represents.
*/
- adv->ccb_infos = mallocarray(adv->max_openings, sizeof(*adv->ccb_infos),
+ adv->ccb_infos = malloc(sizeof(*adv->ccb_infos) * adv->max_openings,
M_DEVBUF, M_NOWAIT);
if (adv->ccb_infos == NULL)
diff --git a/sys/dev/ath/if_ath_rx_edma.c b/sys/dev/ath/if_ath_rx_edma.c
index b8b201b96826..3f0498140ca8 100644
--- a/sys/dev/ath/if_ath_rx_edma.c
+++ b/sys/dev/ath/if_ath_rx_edma.c
@@ -901,8 +901,9 @@ ath_edma_setup_rxfifo(struct ath_softc *sc, HAL_RX_QUEUE qtype)
re->m_fifolen);
/* Allocate ath_buf FIFO array, pre-zero'ed */
- re->m_fifo = mallocarray(re->m_fifolen, sizeof(struct ath_buf *),
- M_ATHDEV, M_NOWAIT | M_ZERO);
+ re->m_fifo = malloc(sizeof(struct ath_buf *) * re->m_fifolen,
+ M_ATHDEV,
+ M_NOWAIT | M_ZERO);
if (re->m_fifo == NULL) {
device_printf(sc->sc_dev, "%s: malloc failed\n",
__func__);
diff --git a/sys/dev/beri/virtio/virtio.c b/sys/dev/beri/virtio/virtio.c
index 85033fef7414..78e3e2168f48 100644
--- a/sys/dev/beri/virtio/virtio.c
+++ b/sys/dev/beri/virtio/virtio.c
@@ -250,7 +250,7 @@ getcopy(struct iovec *iov, int n)
struct iovec *tiov;
int i;
- tiov = mallocarray(n, sizeof(struct iovec), M_DEVBUF, M_NOWAIT);
+ tiov = malloc(n * sizeof(struct iovec), M_DEVBUF, M_NOWAIT);
for (i = 0; i < n; i++) {
tiov[i].iov_base = iov[i].iov_base;
tiov[i].iov_len = iov[i].iov_len;
diff --git a/sys/dev/bnxt/if_bnxt.c b/sys/dev/bnxt/if_bnxt.c
index fb9f00dc0437..2a0262d49322 100644
--- a/sys/dev/bnxt/if_bnxt.c
+++ b/sys/dev/bnxt/if_bnxt.c
@@ -351,7 +351,7 @@ bnxt_tx_queues_alloc(if_ctx_t ctx, caddr_t *vaddrs,
softc = iflib_get_softc(ctx);
- softc->tx_cp_rings = mallocarray(ntxqsets, sizeof(struct bnxt_cp_ring),
+ softc->tx_cp_rings = malloc(sizeof(struct bnxt_cp_ring) * ntxqsets,
M_DEVBUF, M_NOWAIT | M_ZERO);
if (!softc->tx_cp_rings) {
device_printf(iflib_get_dev(ctx),
@@ -359,7 +359,7 @@ bnxt_tx_queues_alloc(if_ctx_t ctx, caddr_t *vaddrs,
rc = ENOMEM;
goto cp_alloc_fail;
}
- softc->tx_rings = mallocarray(ntxqsets, sizeof(struct bnxt_ring),
+ softc->tx_rings = malloc(sizeof(struct bnxt_ring) * ntxqsets,
M_DEVBUF, M_NOWAIT | M_ZERO);
if (!softc->tx_rings) {
device_printf(iflib_get_dev(ctx),
@@ -446,7 +446,7 @@ bnxt_rx_queues_alloc(if_ctx_t ctx, caddr_t *vaddrs,
softc = iflib_get_softc(ctx);
- softc->rx_cp_rings = mallocarray(nrxqsets, sizeof(struct bnxt_cp_ring),
+ softc->rx_cp_rings = malloc(sizeof(struct bnxt_cp_ring) * nrxqsets,
M_DEVBUF, M_NOWAIT | M_ZERO);
if (!softc->rx_cp_rings) {
device_printf(iflib_get_dev(ctx),
@@ -454,7 +454,7 @@ bnxt_rx_queues_alloc(if_ctx_t ctx, caddr_t *vaddrs,
rc = ENOMEM;
goto cp_alloc_fail;
}
- softc->rx_rings = mallocarray(nrxqsets, sizeof(struct bnxt_ring),
+ softc->rx_rings = malloc(sizeof(struct bnxt_ring) * nrxqsets,
M_DEVBUF, M_NOWAIT | M_ZERO);
if (!softc->rx_rings) {
device_printf(iflib_get_dev(ctx),
@@ -462,7 +462,7 @@ bnxt_rx_queues_alloc(if_ctx_t ctx, caddr_t *vaddrs,
rc = ENOMEM;
goto ring_alloc_fail;
}
- softc->ag_rings = mallocarray(nrxqsets, sizeof(struct bnxt_ring),
+ softc->ag_rings = malloc(sizeof(struct bnxt_ring) * nrxqsets,
M_DEVBUF, M_NOWAIT | M_ZERO);
if (!softc->ag_rings) {
device_printf(iflib_get_dev(ctx),
@@ -470,7 +470,7 @@ bnxt_rx_queues_alloc(if_ctx_t ctx, caddr_t *vaddrs,
rc = ENOMEM;
goto ag_alloc_fail;
}
- softc->grp_info = mallocarray(nrxqsets, sizeof(struct bnxt_grp_info),
+ softc->grp_info = malloc(sizeof(struct bnxt_grp_info) * nrxqsets,
M_DEVBUF, M_NOWAIT | M_ZERO);
if (!softc->grp_info) {
device_printf(iflib_get_dev(ctx),
@@ -540,10 +540,9 @@ bnxt_rx_queues_alloc(if_ctx_t ctx, caddr_t *vaddrs,
softc->rx_rings[i].paddr = paddrs[i * nrxqs + 1];
/* Allocate the TPA start buffer */
- softc->rx_rings[i].tpa_start = mallocarray(
- RX_TPA_START_CMPL_AGG_ID_MASK >> RX_TPA_START_CMPL_AGG_ID_SFT,
- sizeof(struct bnxt_full_tpa_start), M_DEVBUF,
- M_NOWAIT | M_ZERO);
+ softc->rx_rings[i].tpa_start = malloc(sizeof(struct bnxt_full_tpa_start) *
+ (RX_TPA_START_CMPL_AGG_ID_MASK >> RX_TPA_START_CMPL_AGG_ID_SFT),
+ M_DEVBUF, M_NOWAIT | M_ZERO);
if (softc->rx_rings[i].tpa_start == NULL) {
rc = -ENOMEM;
device_printf(softc->dev,
diff --git a/sys/dev/bwn/if_bwn.c b/sys/dev/bwn/if_bwn.c
index 3415876a6ae4..5fb008a07eba 100644
--- a/sys/dev/bwn/if_bwn.c
+++ b/sys/dev/bwn/if_bwn.c
@@ -2677,8 +2677,8 @@ bwn_dma_ringsetup(struct bwn_mac *mac, int controller_index,
if (for_tx)
dr->dr_numslots = BWN_TXRING_SLOTS;
- dr->dr_meta = mallocarray(dr->dr_numslots,
- sizeof(struct bwn_dmadesc_meta), M_DEVBUF, M_NOWAIT | M_ZERO);
+ dr->dr_meta = malloc(dr->dr_numslots * sizeof(struct bwn_dmadesc_meta),
+ M_DEVBUF, M_NOWAIT | M_ZERO);
if (dr->dr_meta == NULL)
goto fail0;
diff --git a/sys/dev/bwn/if_bwn_phy_lp.c b/sys/dev/bwn/if_bwn_phy_lp.c
index 384137f8d4b4..0faee2d8625d 100644
--- a/sys/dev/bwn/if_bwn_phy_lp.c
+++ b/sys/dev/bwn/if_bwn_phy_lp.c
@@ -1127,7 +1127,7 @@ bwn_phy_lp_bugfix(struct bwn_mac *mac)
uint8_t mode;
int8_t txpwridx;
- tabs = (uint32_t *)mallocarray(size, sizeof(uint32_t), M_DEVBUF,
+ tabs = (uint32_t *)malloc(sizeof(uint32_t) * size, M_DEVBUF,
M_NOWAIT | M_ZERO);
if (tabs == NULL) {
device_printf(sc->sc_dev, "failed to allocate buffer.\n");
diff --git a/sys/dev/ciss/ciss.c b/sys/dev/ciss/ciss.c
index 4f1acb8cb75d..be74240880bb 100644
--- a/sys/dev/ciss/ciss.c
+++ b/sys/dev/ciss/ciss.c
@@ -1427,7 +1427,7 @@ ciss_init_logical(struct ciss_softc *sc)
}
sc->ciss_logical =
- mallocarray(sc->ciss_max_logical_bus, sizeof(struct ciss_ldrive *),
+ malloc(sc->ciss_max_logical_bus * sizeof(struct ciss_ldrive *),
CISS_MALLOC_CLASS, M_NOWAIT | M_ZERO);
if (sc->ciss_logical == NULL) {
error = ENXIO;
@@ -1436,7 +1436,7 @@ ciss_init_logical(struct ciss_softc *sc)
for (i = 0; i < sc->ciss_max_logical_bus; i++) {
sc->ciss_logical[i] =
- mallocarray(sc->ciss_cfg->max_logical_supported,
+ malloc(sc->ciss_cfg->max_logical_supported *
sizeof(struct ciss_ldrive),
CISS_MALLOC_CLASS, M_NOWAIT | M_ZERO);
if (sc->ciss_logical[i] == NULL) {
@@ -1549,7 +1549,7 @@ ciss_init_physical(struct ciss_softc *sc)
}
sc->ciss_controllers =
- mallocarray(sc->ciss_max_logical_bus, sizeof(union ciss_device_address),
+ malloc(sc->ciss_max_logical_bus * sizeof (union ciss_device_address),
CISS_MALLOC_CLASS, M_NOWAIT | M_ZERO);
if (sc->ciss_controllers == NULL) {
@@ -1566,7 +1566,7 @@ ciss_init_physical(struct ciss_softc *sc)
}
sc->ciss_physical =
- mallocarray(sc->ciss_max_physical_bus, sizeof(struct ciss_pdrive *),
+ malloc(sc->ciss_max_physical_bus * sizeof(struct ciss_pdrive *),
CISS_MALLOC_CLASS, M_NOWAIT | M_ZERO);
if (sc->ciss_physical == NULL) {
ciss_printf(sc, "Could not allocate memory for physical device map\n");
@@ -2873,7 +2873,7 @@ ciss_cam_init(struct ciss_softc *sc)
*/
maxbus = max(sc->ciss_max_logical_bus, sc->ciss_max_physical_bus +
CISS_PHYSICAL_BASE);
- sc->ciss_cam_sim = mallocarray(maxbus, sizeof(struct cam_sim*),
+ sc->ciss_cam_sim = malloc(maxbus * sizeof(struct cam_sim*),
CISS_MALLOC_CLASS, M_NOWAIT | M_ZERO);
if (sc->ciss_cam_sim == NULL) {
ciss_printf(sc, "can't allocate memory for controller SIM\n");
diff --git a/sys/dev/cxgbe/crypto/t4_crypto.c b/sys/dev/cxgbe/crypto/t4_crypto.c
index f037912dd830..0a1041111ded 100644
--- a/sys/dev/cxgbe/crypto/t4_crypto.c
+++ b/sys/dev/cxgbe/crypto/t4_crypto.c
@@ -1900,7 +1900,7 @@ ccr_newsession(device_t dev, uint32_t *sidp, struct cryptoini *cri)
}
}
if (sess == -1) {
- s = mallocarray(sc->nsessions + 1, sizeof(*s), M_CCR,
+ s = malloc(sizeof(*s) * (sc->nsessions + 1), M_CCR,
M_NOWAIT | M_ZERO);
if (s == NULL) {
mtx_unlock(&sc->lock);
diff --git a/sys/dev/e1000/if_em.c b/sys/dev/e1000/if_em.c
index 11acbef2cba5..96ef523f6381 100644
--- a/sys/dev/e1000/if_em.c
+++ b/sys/dev/e1000/if_em.c
@@ -2835,9 +2835,9 @@ em_if_tx_queues_alloc(if_ctx_t ctx, caddr_t *vaddrs, uint64_t *paddrs, int ntxqs
/* First allocate the top level queue structs */
if (!(adapter->tx_queues =
- (struct em_tx_queue *) mallocarray(adapter->tx_num_queues,
- sizeof(struct em_tx_queue), M_DEVBUF, M_NOWAIT | M_ZERO))) {
- device_printf(iflib_get_dev(ctx), "Unable to allocate queue memory\n");
+ (struct em_tx_queue *) malloc(sizeof(struct em_tx_queue) *
+ adapter->tx_num_queues, M_DEVBUF, M_NOWAIT | M_ZERO))) {
+ device_printf(iflib_get_dev(ctx), "Unable to allocate queue memory\n");
return(ENOMEM);
}
@@ -2849,8 +2849,7 @@ em_if_tx_queues_alloc(if_ctx_t ctx, caddr_t *vaddrs, uint64_t *paddrs, int ntxqs
que->me = txr->me = i;
/* Allocate report status array */
- if (!(txr->tx_rsq = (qidx_t *) mallocarray(scctx->isc_ntxd[0],
- sizeof(qidx_t), M_DEVBUF, M_NOWAIT | M_ZERO))) {
+ if (!(txr->tx_rsq = (qidx_t *) malloc(sizeof(qidx_t) * scctx->isc_ntxd[0], M_DEVBUF, M_NOWAIT | M_ZERO))) {
device_printf(iflib_get_dev(ctx), "failed to allocate rs_idxs memory\n");
error = ENOMEM;
goto fail;
@@ -2882,8 +2881,8 @@ em_if_rx_queues_alloc(if_ctx_t ctx, caddr_t *vaddrs, uint64_t *paddrs, int nrxqs
/* First allocate the top level queue structs */
if (!(adapter->rx_queues =
- (struct em_rx_queue *) mallocarray(adapter->rx_num_queues,
- sizeof(struct em_rx_queue), M_DEVBUF, M_NOWAIT | M_ZERO))) {
+ (struct em_rx_queue *) malloc(sizeof(struct em_rx_queue) *
+ adapter->rx_num_queues, M_DEVBUF, M_NOWAIT | M_ZERO))) {
device_printf(iflib_get_dev(ctx), "Unable to allocate queue memory\n");
error = ENOMEM;
goto fail;
diff --git a/sys/dev/esp/ncr53c9x.c b/sys/dev/esp/ncr53c9x.c
index 5166bcb5273b..98d40ce70697 100644
--- a/sys/dev/esp/ncr53c9x.c
+++ b/sys/dev/esp/ncr53c9x.c
@@ -292,7 +292,7 @@ ncr53c9x_attach(struct ncr53c9x_softc *sc)
} else
sc->sc_imess_self = 0;
- sc->sc_tinfo = mallocarray(sc->sc_ntarg, sizeof(sc->sc_tinfo[0]),
+ sc->sc_tinfo = malloc(sc->sc_ntarg * sizeof(sc->sc_tinfo[0]),
M_DEVBUF, M_NOWAIT | M_ZERO);
if (sc->sc_tinfo == NULL) {
device_printf(sc->sc_dev,
diff --git a/sys/dev/fb/splash.c b/sys/dev/fb/splash.c
index 1bcec1c5a504..c3e1946ad0e8 100644
--- a/sys/dev/fb/splash.c
+++ b/sys/dev/fb/splash.c
@@ -136,8 +136,8 @@ splash_register(splash_decoder_t *decoder)
break;
}
if ((i >= decoders) && (decoders % DECODER_ARRAY_DELTA) == 0) {
- p = mallocarray(decoders + DECODER_ARRAY_DELTA,
- sizeof(*p), M_DEVBUF, M_NOWAIT);
+ p = malloc(sizeof(*p)*(decoders + DECODER_ARRAY_DELTA),
+ M_DEVBUF, M_NOWAIT);
if (p == NULL)
return ENOMEM;
if (decoder_set != NULL) {
diff --git a/sys/dev/gpio/gpiobus.c b/sys/dev/gpio/gpiobus.c
index 551dc3820837..133b72185d7f 100644
--- a/sys/dev/gpio/gpiobus.c
+++ b/sys/dev/gpio/gpiobus.c
@@ -235,7 +235,7 @@ gpiobus_init_softc(device_t dev)
/* Pins = GPIO_PIN_MAX() + 1 */
sc->sc_npins++;
- sc->sc_pins = mallocarray(sc->sc_npins, sizeof(*sc->sc_pins), M_DEVBUF,
+ sc->sc_pins = malloc(sizeof(*sc->sc_pins) * sc->sc_npins, M_DEVBUF,
M_NOWAIT | M_ZERO);
if (sc->sc_pins == NULL)
return (ENOMEM);
@@ -251,11 +251,11 @@ gpiobus_alloc_ivars(struct gpiobus_ivar *devi)
{
/* Allocate pins and flags memory. */
- devi->pins = mallocarray(devi->npins, sizeof(uint32_t), M_DEVBUF,
+ devi->pins = malloc(sizeof(uint32_t) * devi->npins, M_DEVBUF,
M_NOWAIT | M_ZERO);
if (devi->pins == NULL)
return (ENOMEM);
- devi->flags = mallocarray(devi->npins, sizeof(uint32_t), M_DEVBUF,
+ devi->flags = malloc(sizeof(uint32_t) * devi->npins, M_DEVBUF,
M_NOWAIT | M_ZERO);
if (devi->flags == NULL) {
free(devi->pins, M_DEVBUF);
diff --git a/sys/dev/if_ndis/if_ndis.c b/sys/dev/if_ndis/if_ndis.c
index cd0c4423e0aa..c0a4a3cc1907 100644
--- a/sys/dev/if_ndis/if_ndis.c
+++ b/sys/dev/if_ndis/if_ndis.c
@@ -665,8 +665,8 @@ ndis_attach(device_t dev)
if (sc->ndis_maxpkts == 0)
sc->ndis_maxpkts = 10;
- sc->ndis_txarray = mallocarray(sc->ndis_maxpkts,
- sizeof(ndis_packet *), M_DEVBUF, M_NOWAIT|M_ZERO);
+ sc->ndis_txarray = malloc(sizeof(ndis_packet *) *
+ sc->ndis_maxpkts, M_DEVBUF, M_NOWAIT|M_ZERO);
/* Allocate a pool of ndis_packets for TX encapsulation. */
diff --git a/sys/dev/iwi/if_iwi.c b/sys/dev/iwi/if_iwi.c
index 71a017e3fcb5..43950a8c608c 100644
--- a/sys/dev/iwi/if_iwi.c
+++ b/sys/dev/iwi/if_iwi.c
@@ -640,7 +640,7 @@ iwi_alloc_tx_ring(struct iwi_softc *sc, struct iwi_tx_ring *ring, int count,
goto fail;
}
- ring->data = mallocarray(count, sizeof(struct iwi_tx_data), M_DEVBUF,
+ ring->data = malloc(count * sizeof (struct iwi_tx_data), M_DEVBUF,
M_NOWAIT | M_ZERO);
if (ring->data == NULL) {
device_printf(sc->sc_dev, "could not allocate soft data\n");
@@ -748,7 +748,7 @@ iwi_alloc_rx_ring(struct iwi_softc *sc, struct iwi_rx_ring *ring, int count)
ring->count = count;
ring->cur = 0;
- ring->data = mallocarray(count, sizeof(struct iwi_rx_data), M_DEVBUF,
+ ring->data = malloc(count * sizeof (struct iwi_rx_data), M_DEVBUF,
M_NOWAIT | M_ZERO);
if (ring->data == NULL) {
device_printf(sc->sc_dev, "could not allocate soft data\n");
diff --git a/sys/dev/ixl/if_ixlv.c b/sys/dev/ixl/if_ixlv.c
index 23c830e629ab..390ef51e5ce8 100644
--- a/sys/dev/ixl/if_ixlv.c
+++ b/sys/dev/ixl/if_ixlv.c
@@ -1637,8 +1637,8 @@ ixlv_setup_queues(struct ixlv_sc *sc)
/* Get memory for the station queues */
if (!(vsi->queues =
- (struct ixl_queue *) mallocarray(vsi->num_queues,
- sizeof(struct ixl_queue), M_DEVBUF, M_NOWAIT | M_ZERO))) {
+ (struct ixl_queue *) malloc(sizeof(struct ixl_queue) *
+ vsi->num_queues, M_DEVBUF, M_NOWAIT | M_ZERO))) {
device_printf(dev, "Unable to allocate queue memory\n");
error = ENOMEM;
goto early;
diff --git a/sys/dev/ixl/ixl_pf_iov.c b/sys/dev/ixl/ixl_pf_iov.c
index ec9f98bfdfff..2662d0df65a2 100644
--- a/sys/dev/ixl/ixl_pf_iov.c
+++ b/sys/dev/ixl/ixl_pf_iov.c
@@ -1695,8 +1695,8 @@ ixl_iov_init(device_t dev, uint16_t num_vfs, const nvlist_t *params)
pf_vsi = &pf->vsi;
IXL_PF_LOCK(pf);
- pf->vfs = mallocarray(num_vfs, sizeof(struct ixl_vf), M_IXL,
- M_NOWAIT | M_ZERO);
+ pf->vfs = malloc(sizeof(struct ixl_vf) * num_vfs, M_IXL, M_NOWAIT |
+ M_ZERO);
if (pf->vfs == NULL) {
error = ENOMEM;
diff --git a/sys/dev/ixl/ixl_pf_main.c b/sys/dev/ixl/ixl_pf_main.c
index 0028cc4bfe85..fa271d434ec4 100644
--- a/sys/dev/ixl/ixl_pf_main.c
+++ b/sys/dev/ixl/ixl_pf_main.c
@@ -2431,8 +2431,8 @@ ixl_setup_stations(struct ixl_pf *pf)
/* Get memory for the station queues */
if (!(vsi->queues =
- (struct ixl_queue *) mallocarray(vsi->num_queues,
- sizeof(struct ixl_queue), M_DEVBUF, M_NOWAIT | M_ZERO))) {
+ (struct ixl_queue *) malloc(sizeof(struct ixl_queue) *
+ vsi->num_queues, M_DEVBUF, M_NOWAIT | M_ZERO))) {
device_printf(dev, "Unable to allocate queue memory\n");
error = ENOMEM;
return (error);
@@ -3317,7 +3317,7 @@ ixl_add_hw_filters(struct ixl_vsi *vsi, int flags, int cnt)
hw = &pf->hw;
IXL_PF_LOCK_ASSERT(pf);
- a = mallocarray(cnt, sizeof(struct i40e_aqc_add_macvlan_element_data),
+ a = malloc(sizeof(struct i40e_aqc_add_macvlan_element_data) * cnt,
M_DEVBUF, M_NOWAIT | M_ZERO);
if (a == NULL) {
device_printf(dev, "add_hw_filters failed to get memory\n");
@@ -3380,8 +3380,7 @@ ixl_del_hw_filters(struct ixl_vsi *vsi, int cnt)
hw = &pf->hw;
dev = pf->dev;
- d = mallocarray(cnt,
- sizeof(struct i40e_aqc_remove_macvlan_element_data),
+ d = malloc(sizeof(struct i40e_aqc_remove_macvlan_element_data) * cnt,
M_DEVBUF, M_NOWAIT | M_ZERO);
if (d == NULL) {
printf("del hw filter failed to get memory\n");
diff --git a/sys/dev/kbd/kbd.c b/sys/dev/kbd/kbd.c
index 6f92409a44a3..df6e107604a7 100644
--- a/sys/dev/kbd/kbd.c
+++ b/sys/dev/kbd/kbd.c
@@ -94,18 +94,17 @@ kbd_realloc_array(void)
{
keyboard_t **new_kbd;
keyboard_switch_t **new_kbdsw;
- u_int newsize;
+ int newsize;
int s;
s = spltty();
newsize = rounddown(keyboards + ARRAY_DELTA, ARRAY_DELTA);
- new_kbd = mallocarray(newsize, sizeof(*new_kbd), M_DEVBUF,
- M_NOWAIT|M_ZERO);
+ new_kbd = malloc(sizeof(*new_kbd)*newsize, M_DEVBUF, M_NOWAIT|M_ZERO);
if (new_kbd == NULL) {
splx(s);
return (ENOMEM);
}
- new_kbdsw = mallocarray(newsize, sizeof(*new_kbdsw), M_DEVBUF,
+ new_kbdsw = malloc(sizeof(*new_kbdsw)*newsize, M_DEVBUF,
M_NOWAIT|M_ZERO);
if (new_kbdsw == NULL) {
free(new_kbd, M_DEVBUF);
diff --git a/sys/dev/liquidio/base/lio_request_manager.c b/sys/dev/liquidio/base/lio_request_manager.c
index 2c0660ab0d57..db7548e7ddff 100644
--- a/sys/dev/liquidio/base/lio_request_manager.c
+++ b/sys/dev/liquidio/base/lio_request_manager.c
@@ -110,7 +110,7 @@ lio_init_instr_queue(struct octeon_device *oct, union octeon_txpciq txpciq,
* Initialize a list to holds requests that have been posted to
* Octeon but has yet to be fetched by octeon
*/
- iq->request_list = mallocarray(num_descs, sizeof(*iq->request_list),
+ iq->request_list = malloc(sizeof(*iq->request_list) * num_descs,
M_DEVBUF, M_NOWAIT | M_ZERO);
if (iq->request_list == NULL) {
lio_dev_err(oct, "Alloc failed for IQ[%d] nr free list\n",
diff --git a/sys/dev/liquidio/lio_main.c b/sys/dev/liquidio/lio_main.c
index d878a5a78ded..99e9ad2e3164 100644
--- a/sys/dev/liquidio/lio_main.c
+++ b/sys/dev/liquidio/lio_main.c
@@ -1724,12 +1724,12 @@ lio_setup_glists(struct octeon_device *oct, struct lio *lio, int num_iqs)
struct lio_gather *g;
int i, j;
- lio->glist_lock = mallocarray(num_iqs, sizeof(*lio->glist_lock),
- M_DEVBUF, M_NOWAIT | M_ZERO);
+ lio->glist_lock = malloc(num_iqs * sizeof(*lio->glist_lock), M_DEVBUF,
+ M_NOWAIT | M_ZERO);
if (lio->glist_lock == NULL)
return (1);
- lio->ghead = mallocarray(num_iqs, sizeof(*lio->ghead), M_DEVBUF,
+ lio->ghead = malloc(num_iqs * sizeof(*lio->ghead), M_DEVBUF,
M_NOWAIT | M_ZERO);
if (lio->ghead == NULL) {
free((void *)lio->glist_lock, M_DEVBUF);
@@ -1743,10 +1743,10 @@ lio_setup_glists(struct octeon_device *oct, struct lio *lio, int num_iqs)
* allocate memory to store virtual and dma base address of
* per glist consistent memory
*/
- lio->glists_virt_base = mallocarray(num_iqs, sizeof(void *), M_DEVBUF,
+ lio->glists_virt_base = malloc(num_iqs * sizeof(void *), M_DEVBUF,
M_NOWAIT | M_ZERO);
- lio->glists_dma_base = mallocarray(num_iqs, sizeof(vm_paddr_t),
- M_DEVBUF, M_NOWAIT | M_ZERO);
+ lio->glists_dma_base = malloc(num_iqs * sizeof(vm_paddr_t), M_DEVBUF,
+ M_NOWAIT | M_ZERO);
if ((lio->glists_virt_base == NULL) || (lio->glists_dma_base == NULL)) {
lio_delete_glists(oct, lio);
return (1);
diff --git a/sys/dev/mpr/mpr.c b/sys/dev/mpr/mpr.c
index b462636a6cfc..6aff753edc7b 100644
--- a/sys/dev/mpr/mpr.c
+++ b/sys/dev/mpr/mpr.c
@@ -1192,7 +1192,7 @@ mpr_alloc_queues(struct mpr_softc *sc)
nq = sc->msi_msgs;
mpr_dprint(sc, MPR_INIT|MPR_XINFO, "Allocating %d I/O queues\n", nq);
- sc->queues = mallocarray(nq, sizeof(struct mpr_queue), M_MPR,
+ sc->queues = malloc(sizeof(struct mpr_queue) * nq, M_MPR,
M_NOWAIT|M_ZERO);
if (sc->queues == NULL)
return (ENOMEM);
diff --git a/sys/dev/mpr/mpr_mapping.c b/sys/dev/mpr/mpr_mapping.c
index 532a69114b13..6d90c79efca8 100644
--- a/sys/dev/mpr/mpr_mapping.c
+++ b/sys/dev/mpr/mpr_mapping.c
@@ -2141,27 +2141,27 @@ mpr_mapping_allocate_memory(struct mpr_softc *sc)
{
uint32_t dpm_pg0_sz;
- sc->mapping_table = mallocarray(sc->max_devices,
- sizeof(struct dev_mapping_table), M_MPR, M_ZERO|M_NOWAIT);
+ sc->mapping_table = malloc((sizeof(struct dev_mapping_table) *
+ sc->max_devices), M_MPR, M_ZERO|M_NOWAIT);
if (!sc->mapping_table)
goto free_resources;
- sc->removal_table = mallocarray(sc->max_devices,
- sizeof(struct map_removal_table), M_MPR, M_ZERO|M_NOWAIT);
+ sc->removal_table = malloc((sizeof(struct map_removal_table) *
+ sc->max_devices), M_MPR, M_ZERO|M_NOWAIT);
if (!sc->removal_table)
goto free_resources;
- sc->enclosure_table = mallocarray(sc->max_enclosures,
- sizeof(struct enc_mapping_table), M_MPR, M_ZERO|M_NOWAIT);
+ sc->enclosure_table = malloc((sizeof(struct enc_mapping_table) *
+ sc->max_enclosures), M_MPR, M_ZERO|M_NOWAIT);
if (!sc->enclosure_table)
goto free_resources;
- sc->dpm_entry_used = mallocarray(sc->max_dpm_entries, sizeof(u8),
+ sc->dpm_entry_used = malloc((sizeof(u8) * sc->max_dpm_entries),
M_MPR, M_ZERO|M_NOWAIT);
if (!sc->dpm_entry_used)
goto free_resources;
- sc->dpm_flush_entry = mallocarray(sc->max_dpm_entries, sizeof(u8),
+ sc->dpm_flush_entry = malloc((sizeof(u8) * sc->max_dpm_entries),
M_MPR, M_ZERO|M_NOWAIT);
if (!sc->dpm_flush_entry)
goto free_resources;
@@ -2912,7 +2912,7 @@ mpr_mapping_topology_change_event(struct mpr_softc *sc,
if (!num_entries)
goto out;
- phy_change = mallocarray(num_entries, sizeof(struct _map_phy_change),
+ phy_change = malloc(sizeof(struct _map_phy_change) * num_entries,
M_MPR, M_NOWAIT|M_ZERO);
topo_change.phy_details = phy_change;
if (!phy_change)
@@ -2963,7 +2963,7 @@ mpr_mapping_pcie_topology_change_event(struct mpr_softc *sc,
if (!num_entries)
goto out;
- port_change = mallocarray(num_entries, sizeof(struct _map_port_change),
+ port_change = malloc(sizeof(struct _map_port_change) * num_entries,
M_MPR, M_NOWAIT|M_ZERO);
topo_change.port_details = port_change;
if (!port_change)
@@ -3003,7 +3003,7 @@ mpr_mapping_ir_config_change_event(struct mpr_softc *sc,
struct dev_mapping_table *mt_entry;
u16 element_flags;
- wwid_table = mallocarray(event_data->NumElements, sizeof(u64), M_MPR,
+ wwid_table = malloc(sizeof(u64) * event_data->NumElements, M_MPR,
M_NOWAIT | M_ZERO);
if (!wwid_table)
goto out;
diff --git a/sys/dev/mps/mps.c b/sys/dev/mps/mps.c
index ee26c84c2ac1..2f684bdd3c6e 100644
--- a/sys/dev/mps/mps.c
+++ b/sys/dev/mps/mps.c
@@ -1164,12 +1164,12 @@ static int
mps_alloc_queues(struct mps_softc *sc)
{
struct mps_queue *q;
- u_int nq, i;
+ int nq, i;
nq = sc->msi_msgs;
mps_dprint(sc, MPS_INIT|MPS_XINFO, "Allocating %d I/O queues\n", nq);
- sc->queues = mallocarray(nq, sizeof(struct mps_queue), M_MPT2,
+ sc->queues = malloc(sizeof(struct mps_queue) * nq, M_MPT2,
M_NOWAIT|M_ZERO);
if (sc->queues == NULL)
return (ENOMEM);
diff --git a/sys/dev/mps/mps_mapping.c b/sys/dev/mps/mps_mapping.c
index cda8ee2cce18..9330288acd06 100644
--- a/sys/dev/mps/mps_mapping.c
+++ b/sys/dev/mps/mps_mapping.c
@@ -1694,27 +1694,27 @@ mps_mapping_allocate_memory(struct mps_softc *sc)
{
uint32_t dpm_pg0_sz;
- sc->mapping_table = mallocarray(sc->max_devices,
- sizeof(struct dev_mapping_table), M_MPT2, M_ZERO|M_NOWAIT);
+ sc->mapping_table = malloc((sizeof(struct dev_mapping_table) *
+ sc->max_devices), M_MPT2, M_ZERO|M_NOWAIT);
if (!sc->mapping_table)
goto free_resources;
- sc->removal_table = mallocarray(sc->max_devices,
- sizeof(struct map_removal_table), M_MPT2, M_ZERO|M_NOWAIT);
+ sc->removal_table = malloc((sizeof(struct map_removal_table) *
+ sc->max_devices), M_MPT2, M_ZERO|M_NOWAIT);
if (!sc->removal_table)
goto free_resources;
- sc->enclosure_table = mallocarray(sc->max_enclosures,
- sizeof(struct enc_mapping_table), M_MPT2, M_ZERO|M_NOWAIT);
+ sc->enclosure_table = malloc((sizeof(struct enc_mapping_table) *
+ sc->max_enclosures), M_MPT2, M_ZERO|M_NOWAIT);
if (!sc->enclosure_table)
goto free_resources;
- sc->dpm_entry_used = mallocarray(sc->max_dpm_entries, sizeof(u8),
+ sc->dpm_entry_used = malloc((sizeof(u8) * sc->max_dpm_entries),
M_MPT2, M_ZERO|M_NOWAIT);
if (!sc->dpm_entry_used)
goto free_resources;
- sc->dpm_flush_entry = mallocarray(sc->max_dpm_entries, sizeof(u8),
+ sc->dpm_flush_entry = malloc((sizeof(u8) * sc->max_dpm_entries),
M_MPT2, M_ZERO|M_NOWAIT);
if (!sc->dpm_flush_entry)
goto free_resources;
@@ -2451,7 +2451,7 @@ mps_mapping_topology_change_event(struct mps_softc *sc,
if (!num_entries)
goto out;
- phy_change = mallocarray(num_entries, sizeof(struct _map_phy_change),
+ phy_change = malloc(sizeof(struct _map_phy_change) * num_entries,
M_MPT2, M_NOWAIT|M_ZERO);
topo_change.phy_details = phy_change;
if (!phy_change)
@@ -2492,7 +2492,7 @@ mps_mapping_ir_config_change_event(struct mps_softc *sc,
struct dev_mapping_table *mt_entry;
u16 element_flags;
- wwid_table = mallocarray(event_data->NumElements, sizeof(u64), M_MPT2,
+ wwid_table = malloc(sizeof(u64) * event_data->NumElements, M_MPT2,
M_NOWAIT | M_ZERO);
if (!wwid_table)
goto out;
diff --git a/sys/dev/mpt/mpt_cam.c b/sys/dev/mpt/mpt_cam.c
index 593295036b4c..4fbca1d9fe25 100644
--- a/sys/dev/mpt/mpt_cam.c
+++ b/sys/dev/mpt/mpt_cam.c
@@ -637,8 +637,8 @@ mptsas_sas_io_unit_pg0(struct mpt_softc *mpt, struct mptsas_portinfo *portinfo)
}
portinfo->num_phys = buffer->NumPhys;
- portinfo->phy_info = mallocarray(portinfo->num_phys,
- sizeof(*portinfo->phy_info), M_DEVBUF, M_NOWAIT|M_ZERO);
+ portinfo->phy_info = malloc(sizeof(*portinfo->phy_info) *
+ portinfo->num_phys, M_DEVBUF, M_NOWAIT|M_ZERO);
if (portinfo->phy_info == NULL) {
free(buffer, M_DEVBUF);
error = ENOMEM;
@@ -4234,7 +4234,7 @@ mpt_add_target_commands(struct mpt_softc *mpt)
max = mpt->mpt_max_tgtcmds;
}
mpt->tgt_cmd_ptrs =
- mallocarray(max, sizeof(request_t *), M_DEVBUF, M_NOWAIT | M_ZERO);
+ malloc(max * sizeof (request_t *), M_DEVBUF, M_NOWAIT | M_ZERO);
if (mpt->tgt_cmd_ptrs == NULL) {
mpt_prt(mpt,
"mpt_add_target_commands: could not allocate cmd ptrs\n");
diff --git a/sys/dev/mrsas/mrsas.c b/sys/dev/mrsas/mrsas.c
index 71c8f86290a3..d5e83494284e 100644
--- a/sys/dev/mrsas/mrsas.c
+++ b/sys/dev/mrsas/mrsas.c
@@ -2566,8 +2566,7 @@ mrsas_alloc_mpt_cmds(struct mrsas_softc *sc)
* Allocate the dynamic array first and then allocate individual
* commands.
*/
- sc->mpt_cmd_list = mallocarray(max_cmd, sizeof(struct mrsas_mpt_cmd *),
- M_MRSAS, M_NOWAIT);
+ sc->mpt_cmd_list = malloc(sizeof(struct mrsas_mpt_cmd *) * max_cmd, M_MRSAS, M_NOWAIT);
if (!sc->mpt_cmd_list) {
device_printf(sc->mrsas_dev, "Cannot alloc memory for mpt_cmd_list.\n");
return (ENOMEM);
diff --git a/sys/dev/mxge/if_mxge.c b/sys/dev/mxge/if_mxge.c
index a5d46c721b3c..edd5ff3a972f 100644
--- a/sys/dev/mxge/if_mxge.c
+++ b/sys/dev/mxge/if_mxge.c
@@ -688,7 +688,7 @@ z_alloc(void *nil, u_int items, u_int size)
{
void *ptr;
- ptr = mallocarray(items, size, M_TEMP, M_NOWAIT);
+ ptr = malloc(items * size, M_TEMP, M_NOWAIT);
return ptr;
}
@@ -4390,8 +4390,8 @@ mxge_alloc_slices(mxge_softc_t *sc)
sc->rx_ring_size = cmd.data0;
max_intr_slots = 2 * (sc->rx_ring_size / sizeof (mcp_dma_addr_t));
- sc->ss = mallocarray(sc->num_slices, sizeof(*sc->ss), M_DEVBUF,
- M_NOWAIT | M_ZERO);
+ bytes = sizeof (*sc->ss) * sc->num_slices;
+ sc->ss = malloc(bytes, M_DEVBUF, M_NOWAIT | M_ZERO);
if (sc->ss == NULL)
return (ENOMEM);
for (i = 0; i < sc->num_slices; i++) {
@@ -4535,6 +4535,7 @@ abort_with_fw:
static int
mxge_add_msix_irqs(mxge_softc_t *sc)
{
+ size_t bytes;
int count, err, i, rid;
rid = PCIR_BAR(2);
@@ -4562,8 +4563,8 @@ mxge_add_msix_irqs(mxge_softc_t *sc)
err = ENOSPC;
goto abort_with_msix;
}
- sc->msix_irq_res = mallocarray(sc->num_slices,
- sizeof(*sc->msix_irq_res), M_DEVBUF, M_NOWAIT|M_ZERO);
+ bytes = sizeof (*sc->msix_irq_res) * sc->num_slices;
+ sc->msix_irq_res = malloc(bytes, M_DEVBUF, M_NOWAIT|M_ZERO);
if (sc->msix_irq_res == NULL) {
err = ENOMEM;
goto abort_with_msix;
@@ -4582,8 +4583,8 @@ mxge_add_msix_irqs(mxge_softc_t *sc)
}
}
- sc->msix_ih = mallocarray(sc->num_slices, sizeof(*sc->msix_ih),
- M_DEVBUF, M_NOWAIT|M_ZERO);
+ bytes = sizeof (*sc->msix_ih) * sc->num_slices;
+ sc->msix_ih = malloc(bytes, M_DEVBUF, M_NOWAIT|M_ZERO);
for (i = 0; i < sc->num_slices; i++) {
err = bus_setup_intr(sc->dev, sc->msix_irq_res[i],
diff --git a/sys/dev/netmap/if_ptnet.c b/sys/dev/netmap/if_ptnet.c
index 5fea3510dc62..4c7072774df4 100644
--- a/sys/dev/netmap/if_ptnet.c
+++ b/sys/dev/netmap/if_ptnet.c
@@ -351,7 +351,7 @@ ptnet_attach(device_t dev)
sc->num_tx_rings = num_tx_rings;
/* Allocate and initialize per-queue data structures. */
- sc->queues = mallocarray(sc->num_rings, sizeof(struct ptnet_queue),
+ sc->queues = malloc(sizeof(struct ptnet_queue) * sc->num_rings,
M_DEVBUF, M_NOWAIT | M_ZERO);
if (sc->queues == NULL) {
err = ENOMEM;
diff --git a/sys/dev/nvme/nvme_ns.c b/sys/dev/nvme/nvme_ns.c
index 96e2d67b3462..2fe1c8b90896 100644
--- a/sys/dev/nvme/nvme_ns.c
+++ b/sys/dev/nvme/nvme_ns.c
@@ -321,8 +321,7 @@ nvme_allocate_child_bios(int num_bios)
struct bio **child_bios;
int err = 0, i;
- child_bios = mallocarray(num_bios, sizeof(struct bio *), M_NVME,
- M_NOWAIT);
+ child_bios = malloc(num_bios * sizeof(struct bio *), M_NVME, M_NOWAIT);
if (child_bios == NULL)
return (NULL);
diff --git a/sys/dev/pst/pst-iop.c b/sys/dev/pst/pst-iop.c
index b4819f35c72a..15fbf36b6328 100644
--- a/sys/dev/pst/pst-iop.c
+++ b/sys/dev/pst/pst-iop.c
@@ -323,7 +323,7 @@ iop_get_lct(struct iop_softc *sc)
contigfree(reply, ALLOCSIZE, M_PSTIOP);
return 0;
}
- if (!(sc->lct = mallocarray(reply->table_size, sizeof(struct i2o_lct_entry),
+ if (!(sc->lct = malloc(reply->table_size * sizeof(struct i2o_lct_entry),
M_PSTIOP, M_NOWAIT | M_ZERO))) {
contigfree(reply, ALLOCSIZE, M_PSTIOP);
return 0;
diff --git a/sys/dev/ral/rt2560.c b/sys/dev/ral/rt2560.c
index ce396dc81094..9da26a8f581a 100644
--- a/sys/dev/ral/rt2560.c
+++ b/sys/dev/ral/rt2560.c
@@ -488,7 +488,7 @@ rt2560_alloc_tx_ring(struct rt2560_softc *sc, struct rt2560_tx_ring *ring,
goto fail;
}
- ring->data = mallocarray(count, sizeof(struct rt2560_tx_data), M_DEVBUF,
+ ring->data = malloc(count * sizeof (struct rt2560_tx_data), M_DEVBUF,
M_NOWAIT | M_ZERO);
if (ring->data == NULL) {
device_printf(sc->sc_dev, "could not allocate soft data\n");
@@ -632,8 +632,8 @@ rt2560_alloc_rx_ring(struct rt2560_softc *sc, struct rt2560_rx_ring *ring,
goto fail;
}
- ring->data = mallocarray(count, sizeof (struct rt2560_rx_data),
- M_DEVBUF, M_NOWAIT | M_ZERO);
+ ring->data = malloc(count * sizeof (struct rt2560_rx_data), M_DEVBUF,
+ M_NOWAIT | M_ZERO);
if (ring->data == NULL) {
device_printf(sc->sc_dev, "could not allocate soft data\n");
error = ENOMEM;
diff --git a/sys/dev/ral/rt2661.c b/sys/dev/ral/rt2661.c
index 55dedd4eaba6..aab385a5855f 100644
--- a/sys/dev/ral/rt2661.c
+++ b/sys/dev/ral/rt2661.c
@@ -497,7 +497,7 @@ rt2661_alloc_tx_ring(struct rt2661_softc *sc, struct rt2661_tx_ring *ring,
goto fail;
}
- ring->data = mallocarray(count, sizeof(struct rt2661_tx_data), M_DEVBUF,
+ ring->data = malloc(count * sizeof (struct rt2661_tx_data), M_DEVBUF,
M_NOWAIT | M_ZERO);
if (ring->data == NULL) {
device_printf(sc->sc_dev, "could not allocate soft data\n");
@@ -638,7 +638,7 @@ rt2661_alloc_rx_ring(struct rt2661_softc *sc, struct rt2661_rx_ring *ring,
goto fail;
}
- ring->data = mallocarray(count, sizeof(struct rt2661_rx_data), M_DEVBUF,
+ ring->data = malloc(count * sizeof (struct rt2661_rx_data), M_DEVBUF,
M_NOWAIT | M_ZERO);
if (ring->data == NULL) {
device_printf(sc->sc_dev, "could not allocate soft data\n");
diff --git a/sys/dev/rp/rp.c b/sys/dev/rp/rp.c
index 4eab3251a404..71e309625a25 100644
--- a/sys/dev/rp/rp.c
+++ b/sys/dev/rp/rp.c
@@ -732,8 +732,7 @@ rp_attachcommon(CONTROLLER_T *ctlp, int num_aiops, int num_ports)
ctlp->num_ports = num_ports;
ctlp->rp = rp = (struct rp_port *)
- mallocarray(num_ports, sizeof(struct rp_port), M_DEVBUF,
- M_NOWAIT | M_ZERO);
+ malloc(sizeof(struct rp_port) * num_ports, M_DEVBUF, M_NOWAIT | M_ZERO);
if (rp == NULL) {
device_printf(ctlp->dev, "rp_attachcommon: Could not malloc rp_ports structures.\n");
retval = ENOMEM;
diff --git a/sys/dev/rp/rp_isa.c b/sys/dev/rp/rp_isa.c
index 8bb8f9e9912a..74a84fc78b91 100644
--- a/sys/dev/rp/rp_isa.c
+++ b/sys/dev/rp/rp_isa.c
@@ -178,10 +178,8 @@ rp_probe(device_t dev)
/* The IO ports of AIOPs for an ISA controller are discrete. */
ctlp->io_num = 1;
- ctlp->io_rid = mallocarray(MAX_AIOPS_PER_BOARD, sizeof(*(ctlp->io_rid)),
- M_DEVBUF, M_NOWAIT | M_ZERO);
- ctlp->io = mallocarray(MAX_AIOPS_PER_BOARD, sizeof(*(ctlp->io)),
- M_DEVBUF, M_NOWAIT | M_ZERO);
+ ctlp->io_rid = malloc(sizeof(*(ctlp->io_rid)) * MAX_AIOPS_PER_BOARD, M_DEVBUF, M_NOWAIT | M_ZERO);
+ ctlp->io = malloc(sizeof(*(ctlp->io)) * MAX_AIOPS_PER_BOARD, M_DEVBUF, M_NOWAIT | M_ZERO);
if (ctlp->io_rid == NULL || ctlp->io == NULL) {
device_printf(dev, "rp_attach: Out of memory.\n");
retval = ENOMEM;
diff --git a/sys/dev/rp/rp_pci.c b/sys/dev/rp/rp_pci.c
index ad7fc189e7c5..cfc53b726cdf 100644
--- a/sys/dev/rp/rp_pci.c
+++ b/sys/dev/rp/rp_pci.c
@@ -164,10 +164,8 @@ rp_pciattach(device_t dev)
/* The IO ports of AIOPs for a PCI controller are continuous. */
ctlp->io_num = 1;
- ctlp->io_rid = mallocarray(ctlp->io_num, sizeof(*(ctlp->io_rid)),
- M_DEVBUF, M_NOWAIT | M_ZERO);
- ctlp->io = mallocarray(ctlp->io_num, sizeof(*(ctlp->io)), M_DEVBUF,
- M_NOWAIT | M_ZERO);
+ ctlp->io_rid = malloc(sizeof(*(ctlp->io_rid)) * ctlp->io_num, M_DEVBUF, M_NOWAIT | M_ZERO);
+ ctlp->io = malloc(sizeof(*(ctlp->io)) * ctlp->io_num, M_DEVBUF, M_NOWAIT | M_ZERO);
if (ctlp->io_rid == NULL || ctlp->io == NULL) {
device_printf(dev, "rp_pciattach: Out of memory.\n");
retval = ENOMEM;
diff --git a/sys/dev/sound/midi/midi.c b/sys/dev/sound/midi/midi.c
index 70e5bd1a9295..325106200320 100644
--- a/sys/dev/sound/midi/midi.c
+++ b/sys/dev/sound/midi/midi.c
@@ -340,15 +340,14 @@ midi_init(kobj_class_t cls, int unit, int channel, void *cookie)
mtx_lock(&m->qlock);
if (inqsize)
- buf = mallocarray(inqsize, sizeof(MIDI_TYPE), M_MIDI, M_NOWAIT);
+ buf = malloc(sizeof(MIDI_TYPE) * inqsize, M_MIDI, M_NOWAIT);
else
buf = NULL;
MIDIQ_INIT(m->inq, buf, inqsize);
if (outqsize)
- buf = mallocarray(outqsize, sizeof(MIDI_TYPE), M_MIDI,
- M_NOWAIT);
+ buf = malloc(sizeof(MIDI_TYPE) * outqsize, M_MIDI, M_NOWAIT);
else
buf = NULL;
m->hiwat = outqsize / 2;
diff --git a/sys/dev/sound/pci/hda/hdaa.c b/sys/dev/sound/pci/hda/hdaa.c
index 34d48b4b4c73..b955d1667b8d 100644
--- a/sys/dev/sound/pci/hda/hdaa.c
+++ b/sys/dev/sound/pci/hda/hdaa.c
@@ -3034,8 +3034,8 @@ hdaa_audio_ctl_parse(struct hdaa_devinfo *devinfo)
if (max < 1)
return;
- ctls = (struct hdaa_audio_ctl *)mallocarray(max,
- sizeof(*ctls), M_HDAA, M_ZERO | M_NOWAIT);
+ ctls = (struct hdaa_audio_ctl *)malloc(
+ sizeof(*ctls) * max, M_HDAA, M_ZERO | M_NOWAIT);
if (ctls == NULL) {
/* Blekh! */
@@ -3187,8 +3187,8 @@ hdaa_audio_as_parse(struct hdaa_devinfo *devinfo)
if (max < 1)
return;
- as = (struct hdaa_audio_as *)mallocarray(max,
- sizeof(*as), M_HDAA, M_ZERO | M_NOWAIT);
+ as = (struct hdaa_audio_as *)malloc(
+ sizeof(*as) * max, M_HDAA, M_ZERO | M_NOWAIT);
if (as == NULL) {
/* Blekh! */
@@ -4078,8 +4078,8 @@ hdaa_audio_bind_as(struct hdaa_devinfo *devinfo)
cnt += as[j].num_chans;
}
if (devinfo->num_chans == 0) {
- devinfo->chans = (struct hdaa_chan *)mallocarray(cnt,
- sizeof(struct hdaa_chan),
+ devinfo->chans = (struct hdaa_chan *)malloc(
+ sizeof(struct hdaa_chan) * cnt,
M_HDAA, M_ZERO | M_NOWAIT);
if (devinfo->chans == NULL) {
device_printf(devinfo->dev,
@@ -5491,8 +5491,8 @@ hdaa_prepare_pcms(struct hdaa_devinfo *devinfo)
devinfo->num_devs =
max(ardev, apdev) + max(drdev, dpdev);
devinfo->devs =
- (struct hdaa_pcm_devinfo *)mallocarray(
- devinfo->num_devs, sizeof(struct hdaa_pcm_devinfo),
+ (struct hdaa_pcm_devinfo *)malloc(
+ devinfo->num_devs * sizeof(struct hdaa_pcm_devinfo),
M_HDAA, M_ZERO | M_NOWAIT);
if (devinfo->devs == NULL) {
device_printf(devinfo->dev,
diff --git a/sys/dev/syscons/fire/fire_saver.c b/sys/dev/syscons/fire/fire_saver.c
index e874bf0b84c5..636f6006a421 100644
--- a/sys/dev/syscons/fire/fire_saver.c
+++ b/sys/dev/syscons/fire/fire_saver.c
@@ -155,7 +155,7 @@ fire_init(video_adapter_t *adp)
scrw = info.vi_width;
scrh = info.vi_height;
- buf = (u_char *)mallocarray(scrw, scrh + 1, M_DEVBUF, M_NOWAIT);
+ buf = (u_char *)malloc(scrw * (scrh + 1), M_DEVBUF, M_NOWAIT);
if (buf) {
bzero(buf, scrw * (scrh + 1));
} else {
diff --git a/sys/dev/virtio/console/virtio_console.c b/sys/dev/virtio/console/virtio_console.c
index 00b605b633b1..919e61be90f7 100644
--- a/sys/dev/virtio/console/virtio_console.c
+++ b/sys/dev/virtio/console/virtio_console.c
@@ -474,11 +474,11 @@ static int
vtcon_alloc_scports(struct vtcon_softc *sc)
{
struct vtcon_softc_port *scport;
- u_int max, i;
+ int max, i;
max = sc->vtcon_max_ports;
- sc->vtcon_ports = mallocarray(max, sizeof(struct vtcon_softc_port),
+ sc->vtcon_ports = malloc(sizeof(struct vtcon_softc_port) * max,
M_DEVBUF, M_NOWAIT | M_ZERO);
if (sc->vtcon_ports == NULL)
return (ENOMEM);
@@ -497,8 +497,7 @@ vtcon_alloc_virtqueues(struct vtcon_softc *sc)
device_t dev;
struct vq_alloc_info *info;
struct vtcon_softc_port *scport;
- u_int i, idx, portidx, nvqs;
- int error;
+ int i, idx, portidx, nvqs, error;
dev = sc->vtcon_dev;
@@ -506,8 +505,7 @@ vtcon_alloc_virtqueues(struct vtcon_softc *sc)
if (sc->vtcon_flags & VTCON_FLAG_MULTIPORT)
nvqs += 2;
- info = mallocarray(nvqs, sizeof(struct vq_alloc_info), M_TEMP,
- M_NOWAIT);
+ info = malloc(sizeof(struct vq_alloc_info) * nvqs, M_TEMP, M_NOWAIT);
if (info == NULL)
return (ENOMEM);
diff --git a/sys/dev/virtio/mmio/virtio_mmio.c b/sys/dev/virtio/mmio/virtio_mmio.c
index 52d392574c95..d9c17f5e8421 100644
--- a/sys/dev/virtio/mmio/virtio_mmio.c
+++ b/sys/dev/virtio/mmio/virtio_mmio.c
@@ -507,7 +507,7 @@ vtmmio_alloc_virtqueues(device_t dev, int flags, int nvqs,
if (nvqs <= 0)
return (EINVAL);
- sc->vtmmio_vqs = mallocarray(nvqs, sizeof(struct vtmmio_virtqueue),
+ sc->vtmmio_vqs = malloc(nvqs * sizeof(struct vtmmio_virtqueue),
M_DEVBUF, M_NOWAIT | M_ZERO);
if (sc->vtmmio_vqs == NULL)
return (ENOMEM);
diff --git a/sys/dev/virtio/network/if_vtnet.c b/sys/dev/virtio/network/if_vtnet.c
index fe1b99eddf69..2a7174177d56 100644
--- a/sys/dev/virtio/network/if_vtnet.c
+++ b/sys/dev/virtio/network/if_vtnet.c
@@ -755,9 +755,9 @@ vtnet_alloc_rxtx_queues(struct vtnet_softc *sc)
npairs = sc->vtnet_max_vq_pairs;
- sc->vtnet_rxqs = mallocarray(npairs, sizeof(struct vtnet_rxq), M_DEVBUF,
+ sc->vtnet_rxqs = malloc(sizeof(struct vtnet_rxq) * npairs, M_DEVBUF,
M_NOWAIT | M_ZERO);
- sc->vtnet_txqs = mallocarray(npairs, sizeof(struct vtnet_txq), M_DEVBUF,
+ sc->vtnet_txqs = malloc(sizeof(struct vtnet_txq) * npairs, M_DEVBUF,
M_NOWAIT | M_ZERO);
if (sc->vtnet_rxqs == NULL || sc->vtnet_txqs == NULL)
return (ENOMEM);
@@ -887,8 +887,7 @@ vtnet_alloc_virtqueues(struct vtnet_softc *sc)
if (sc->vtnet_flags & VTNET_FLAG_CTRL_VQ)
nvqs++;
- info = mallocarray(nvqs, sizeof(struct vq_alloc_info), M_TEMP,
- M_NOWAIT);
+ info = malloc(sizeof(struct vq_alloc_info) * nvqs, M_TEMP, M_NOWAIT);
if (info == NULL)
return (ENOMEM);
diff --git a/sys/dev/virtio/pci/virtio_pci.c b/sys/dev/virtio/pci/virtio_pci.c
index f5964996bcfd..100b44cd1843 100644
--- a/sys/dev/virtio/pci/virtio_pci.c
+++ b/sys/dev/virtio/pci/virtio_pci.c
@@ -491,7 +491,7 @@ vtpci_alloc_virtqueues(device_t dev, int flags, int nvqs,
if (nvqs <= 0)
return (EINVAL);
- sc->vtpci_vqs = mallocarray(nvqs, sizeof(struct vtpci_virtqueue),
+ sc->vtpci_vqs = malloc(nvqs * sizeof(struct vtpci_virtqueue),
M_DEVBUF, M_NOWAIT | M_ZERO);
if (sc->vtpci_vqs == NULL)
return (ENOMEM);
@@ -927,7 +927,7 @@ vtpci_alloc_intr_resources(struct vtpci_softc *sc)
/* Subtract one for the configuration changed interrupt. */
nvq_intrs = sc->vtpci_nmsix_resources - 1;
- intr = sc->vtpci_msix_vq_interrupts = mallocarray(nvq_intrs,
+ intr = sc->vtpci_msix_vq_interrupts = malloc(nvq_intrs *
sizeof(struct vtpci_interrupt), M_DEVBUF, M_NOWAIT | M_ZERO);
if (sc->vtpci_msix_vq_interrupts == NULL)
return (ENOMEM);
diff --git a/sys/dev/vmware/vmxnet3/if_vmx.c b/sys/dev/vmware/vmxnet3/if_vmx.c
index 837715a05f86..a83e2de31661 100644
--- a/sys/dev/vmware/vmxnet3/if_vmx.c
+++ b/sys/dev/vmware/vmxnet3/if_vmx.c
@@ -959,7 +959,7 @@ vmxnet3_init_rxq(struct vmxnet3_softc *sc, int q)
rxr = &rxq->vxrxq_cmd_ring[i];
rxr->vxrxr_rid = i;
rxr->vxrxr_ndesc = sc->vmx_nrxdescs;
- rxr->vxrxr_rxbuf = mallocarray(rxr->vxrxr_ndesc,
+ rxr->vxrxr_rxbuf = malloc(rxr->vxrxr_ndesc *
sizeof(struct vmxnet3_rxbuf), M_DEVBUF, M_NOWAIT | M_ZERO);
if (rxr->vxrxr_rxbuf == NULL)
return (ENOMEM);
@@ -987,7 +987,7 @@ vmxnet3_init_txq(struct vmxnet3_softc *sc, int q)
txq->vxtxq_id = q;
txr->vxtxr_ndesc = sc->vmx_ntxdescs;
- txr->vxtxr_txbuf = mallocarray(txr->vxtxr_ndesc,
+ txr->vxtxr_txbuf = malloc(txr->vxtxr_ndesc *
sizeof(struct vmxnet3_txbuf), M_DEVBUF, M_NOWAIT | M_ZERO);
if (txr->vxtxr_txbuf == NULL)
return (ENOMEM);
@@ -1023,10 +1023,10 @@ vmxnet3_alloc_rxtx_queues(struct vmxnet3_softc *sc)
sc->vmx_max_ntxqueues = 1;
}
- sc->vmx_rxq = mallocarray(sc->vmx_max_nrxqueues,
- sizeof(struct vmxnet3_rxqueue), M_DEVBUF, M_NOWAIT | M_ZERO);
- sc->vmx_txq = mallocarray(sc->vmx_max_ntxqueues,
- sizeof(struct vmxnet3_txqueue), M_DEVBUF, M_NOWAIT | M_ZERO);
+ sc->vmx_rxq = malloc(sizeof(struct vmxnet3_rxqueue) *
+ sc->vmx_max_nrxqueues, M_DEVBUF, M_NOWAIT | M_ZERO);
+ sc->vmx_txq = malloc(sizeof(struct vmxnet3_txqueue) *
+ sc->vmx_max_ntxqueues, M_DEVBUF, M_NOWAIT | M_ZERO);
if (sc->vmx_rxq == NULL || sc->vmx_txq == NULL)
return (ENOMEM);
diff --git a/sys/dev/vnic/nicvf_queues.c b/sys/dev/vnic/nicvf_queues.c
index 3bf68a9ccd33..d469067c1cf8 100644
--- a/sys/dev/vnic/nicvf_queues.c
+++ b/sys/dev/vnic/nicvf_queues.c
@@ -1104,7 +1104,7 @@ nicvf_init_snd_queue(struct nicvf *nic, struct snd_queue *sq, int q_len,
}
/* Allocate send buffers array */
- sq->snd_buff = mallocarray(q_len, sizeof(*sq->snd_buff), M_NICVF,
+ sq->snd_buff = malloc(sizeof(*sq->snd_buff) * q_len, M_NICVF,
(M_NOWAIT | M_ZERO));
if (sq->snd_buff == NULL) {
device_printf(nic->dev,
diff --git a/sys/dev/xen/blkback/blkback.c b/sys/dev/xen/blkback/blkback.c
index 88017093c592..bd7a013f8039 100644
--- a/sys/dev/xen/blkback/blkback.c
+++ b/sys/dev/xen/blkback/blkback.c
@@ -3166,7 +3166,7 @@ xbb_alloc_requests(struct xbb_softc *xbb)
/*
* Allocate request book keeping datastructures.
*/
- xbb->requests = mallocarray(xbb->max_requests, sizeof(*xbb->requests),
+ xbb->requests = malloc(xbb->max_requests * sizeof(*xbb->requests),
M_XENBLOCKBACK, M_NOWAIT|M_ZERO);
if (xbb->requests == NULL) {
xenbus_dev_fatal(xbb->dev, ENOMEM,
@@ -3194,7 +3194,7 @@ xbb_alloc_request_lists(struct xbb_softc *xbb)
* If no requests can be merged, we need 1 request list per
* in flight request.
*/
- xbb->request_lists = mallocarray(xbb->max_requests,
+ xbb->request_lists = malloc(xbb->max_requests *
sizeof(*xbb->request_lists), M_XENBLOCKBACK, M_NOWAIT|M_ZERO);
if (xbb->request_lists == NULL) {
xenbus_dev_fatal(xbb->dev, ENOMEM,
@@ -3222,7 +3222,7 @@ xbb_alloc_request_lists(struct xbb_softc *xbb)
}
#endif /* XBB_USE_BOUNCE_BUFFERS */
- reqlist->gnt_handles = mallocarray(xbb->max_reqlist_segments,
+ reqlist->gnt_handles = malloc(xbb->max_reqlist_segments *
sizeof(*reqlist->gnt_handles),
M_XENBLOCKBACK, M_NOWAIT|M_ZERO);
if (reqlist->gnt_handles == NULL) {
diff --git a/sys/dev/xen/blkfront/blkfront.c b/sys/dev/xen/blkfront/blkfront.c
index 00761391be92..2477d783d5fc 100644
--- a/sys/dev/xen/blkfront/blkfront.c
+++ b/sys/dev/xen/blkfront/blkfront.c
@@ -1306,8 +1306,8 @@ xbd_connect(struct xbd_softc *sc)
}
/* Per-transaction data allocation. */
- sc->xbd_shadow = mallocarray(sc->xbd_max_requests,
- sizeof(*sc->xbd_shadow), M_XENBLOCKFRONT, M_NOWAIT|M_ZERO);
+ sc->xbd_shadow = malloc(sizeof(*sc->xbd_shadow) * sc->xbd_max_requests,
+ M_XENBLOCKFRONT, M_NOWAIT|M_ZERO);
if (sc->xbd_shadow == NULL) {
bus_dma_tag_destroy(sc->xbd_io_dmat);
xenbus_dev_fatal(sc->xbd_dev, ENOMEM,
@@ -1320,8 +1320,9 @@ xbd_connect(struct xbd_softc *sc)
void * indirectpages;
cm = &sc->xbd_shadow[i];
- cm->cm_sg_refs = mallocarray(sc->xbd_max_request_segments,
- sizeof(grant_ref_t), M_XENBLOCKFRONT, M_NOWAIT);
+ cm->cm_sg_refs = malloc(
+ sizeof(grant_ref_t) * sc->xbd_max_request_segments,
+ M_XENBLOCKFRONT, M_NOWAIT);
if (cm->cm_sg_refs == NULL)
break;
cm->cm_id = i;
diff --git a/sys/fs/nfsclient/nfs_clvnops.c b/sys/fs/nfsclient/nfs_clvnops.c
index 48b9758adda8..dcee07e6f7a3 100644
--- a/sys/fs/nfsclient/nfs_clvnops.c
+++ b/sys/fs/nfsclient/nfs_clvnops.c
@@ -2666,7 +2666,7 @@ ncl_flush(struct vnode *vp, int waitfor, struct thread *td,
#define NFS_COMMITBVECSIZ 20
#endif
struct buf *bvec_on_stack[NFS_COMMITBVECSIZ];
- u_int bvecsize = 0, bveccount;
+ int bvecsize = 0, bveccount;
if (called_from_renewthread != 0)
slptimeo = hz;
diff --git a/sys/geom/uzip/g_uzip_zlib.c b/sys/geom/uzip/g_uzip_zlib.c
index 544e392cea15..895c92d1c455 100644
--- a/sys/geom/uzip/g_uzip_zlib.c
+++ b/sys/geom/uzip/g_uzip_zlib.c
@@ -132,7 +132,7 @@ z_alloc(void *nil, u_int type, u_int size)
{
void *ptr;
- ptr = mallocarray(type, size, M_GEOM_UZIP, M_NOWAIT);
+ ptr = malloc(type * size, M_GEOM_UZIP, M_NOWAIT);
return (ptr);
}
diff --git a/sys/gnu/dev/bwn/phy_n/if_bwn_phy_n_core.c b/sys/gnu/dev/bwn/phy_n/if_bwn_phy_n_core.c
index 1fe47a9b40da..0e1291ea39b3 100644
--- a/sys/gnu/dev/bwn/phy_n/if_bwn_phy_n_core.c
+++ b/sys/gnu/dev/bwn/phy_n/if_bwn_phy_n_core.c
@@ -1620,7 +1620,7 @@ static int bwn_nphy_load_samples(struct bwn_mac *mac,
uint16_t i;
uint32_t *data;
- data = mallocarray(len, sizeof(uint32_t), M_DEVBUF, M_NOWAIT | M_ZERO);
+ data = malloc(len * sizeof(uint32_t), M_DEVBUF, M_NOWAIT | M_ZERO);
if (!data) {
BWN_ERRPRINTF(mac->mac_sc, "allocation for samples loading failed\n");
return -ENOMEM;
@@ -1663,8 +1663,7 @@ static uint16_t bwn_nphy_gen_load_samples(struct bwn_mac *mac, uint32_t freq, ui
len = bw << 1;
}
- samples = mallocarray(len, sizeof(struct bwn_c32), M_DEVBUF,
- M_NOWAIT | M_ZERO);
+ samples = malloc(len * sizeof(struct bwn_c32), M_DEVBUF, M_NOWAIT | M_ZERO);
if (!samples) {
BWN_ERRPRINTF(mac->mac_sc, "allocation for samples generation failed\n");
return 0;
diff --git a/sys/i386/i386/bpf_jit_machdep.c b/sys/i386/i386/bpf_jit_machdep.c
index d5d93bfd7395..ff3fa3fb0750 100644
--- a/sys/i386/i386/bpf_jit_machdep.c
+++ b/sys/i386/i386/bpf_jit_machdep.c
@@ -185,7 +185,7 @@ bpf_jit_compile(struct bpf_insn *prog, u_int nins, size_t *size)
/* Allocate the reference table for the jumps. */
if (fjmp) {
#ifdef _KERNEL
- stream.refs = mallocarray(nins + 1, sizeof(u_int), M_BPFJIT,
+ stream.refs = malloc((nins + 1) * sizeof(u_int), M_BPFJIT,
M_NOWAIT | M_ZERO);
#else
stream.refs = calloc(nins + 1, sizeof(u_int));
diff --git a/sys/i386/i386/k6_mem.c b/sys/i386/i386/k6_mem.c
index cccd7eca8e9e..2968518ee534 100644
--- a/sys/i386/i386/k6_mem.c
+++ b/sys/i386/i386/k6_mem.c
@@ -107,7 +107,7 @@ k6_mrinit(struct mem_range_softc *sc)
sc->mr_cap = 0;
sc->mr_ndesc = 2; /* XXX (BFF) For now, we only have one msr for this */
- sc->mr_desc = mallocarray(sc->mr_ndesc, sizeof(struct mem_range_desc),
+ sc->mr_desc = malloc(sc->mr_ndesc * sizeof(struct mem_range_desc),
M_MEMDESC, M_NOWAIT | M_ZERO);
if (sc->mr_desc == NULL)
panic("k6_mrinit: malloc returns NULL");
diff --git a/sys/kern/init_main.c b/sys/kern/init_main.c
index 70e1e3d85a35..397bc99452eb 100644
--- a/sys/kern/init_main.c
+++ b/sys/kern/init_main.c
@@ -159,7 +159,7 @@ sysinit_add(struct sysinit **set, struct sysinit **set_end)
count += newsysinit_end - newsysinit;
else
count += sysinit_end - sysinit;
- newset = mallocarray(count, sizeof(*sipp), M_TEMP, M_NOWAIT);
+ newset = malloc(count * sizeof(*sipp), M_TEMP, M_NOWAIT);
if (newset == NULL)
panic("cannot malloc for sysinit");
xipp = newset;
diff --git a/sys/kern/kern_cpu.c b/sys/kern/kern_cpu.c
index 419f0ff78559..193054a4f709 100644
--- a/sys/kern/kern_cpu.c
+++ b/sys/kern/kern_cpu.c
@@ -444,7 +444,7 @@ cf_get_method(device_t dev, struct cf_level *level)
* match of settings against each level.
*/
count = CF_MAX_LEVELS;
- levels = mallocarray(count, sizeof(*levels), M_TEMP, M_NOWAIT);
+ levels = malloc(count * sizeof(*levels), M_TEMP, M_NOWAIT);
if (levels == NULL)
return (ENOMEM);
error = CPUFREQ_LEVELS(sc->dev, levels, &count);
@@ -969,7 +969,7 @@ cpufreq_settings_sysctl(SYSCTL_HANDLER_ARGS)
/* Get settings from the device and generate the output string. */
set_count = MAX_SETTINGS;
- sets = mallocarray(set_count, sizeof(*sets), M_TEMP, M_NOWAIT);
+ sets = malloc(set_count * sizeof(*sets), M_TEMP, M_NOWAIT);
if (sets == NULL) {
sbuf_delete(&sb);
return (ENOMEM);
diff --git a/sys/kern/kern_ctf.c b/sys/kern/kern_ctf.c
index cfc5d06f3d9a..1a63dc5ba31c 100644
--- a/sys/kern/kern_ctf.c
+++ b/sys/kern/kern_ctf.c
@@ -45,7 +45,7 @@ z_alloc(void *nil, u_int items, u_int size)
{
void *ptr;
- ptr = mallocarray(items, size, M_TEMP, M_NOWAIT);
+ ptr = malloc(items * size, M_TEMP, M_NOWAIT);
return ptr;
}
diff --git a/sys/kern/kern_pmc.c b/sys/kern/kern_pmc.c
index 52332a6d0ce3..1694294f9e39 100644
--- a/sys/kern/kern_pmc.c
+++ b/sys/kern/kern_pmc.c
@@ -338,8 +338,7 @@ init_hwpmc(void *dummy __unused)
"range.\n", pmc_softevents);
pmc_softevents = PMC_EV_DYN_COUNT;
}
- pmc_softs = mallocarray(pmc_softevents, sizeof(struct pmc_soft *),
- M_PMCHOOKS, M_NOWAIT|M_ZERO);
+ pmc_softs = malloc(pmc_softevents * sizeof(struct pmc_soft *), M_PMCHOOKS, M_NOWAIT|M_ZERO);
KASSERT(pmc_softs != NULL, ("cannot allocate soft events table"));
}
diff --git a/sys/kern/subr_bus.c b/sys/kern/subr_bus.c
index 7a0cfc97a5ca..b86a476273ab 100644
--- a/sys/kern/subr_bus.c
+++ b/sys/kern/subr_bus.c
@@ -1464,7 +1464,7 @@ devclass_get_devices(devclass_t dc, device_t **devlistp, int *devcountp)
device_t *list;
count = devclass_get_count(dc);
- list = mallocarray(count, sizeof(device_t), M_TEMP, M_NOWAIT|M_ZERO);
+ list = malloc(count * sizeof(device_t), M_TEMP, M_NOWAIT|M_ZERO);
if (!list)
return (ENOMEM);
@@ -1680,7 +1680,7 @@ devclass_alloc_unit(devclass_t dc, device_t dev, int *unitp)
oldlist = dc->devices;
newsize = roundup((unit + 1), MINALLOCSIZE / sizeof(device_t));
- newlist = mallocarray(newsize, sizeof(device_t), M_BUS, M_NOWAIT);
+ newlist = malloc(sizeof(device_t) * newsize, M_BUS, M_NOWAIT);
if (!newlist)
return (ENOMEM);
if (oldlist != NULL)
@@ -2300,7 +2300,7 @@ device_get_children(device_t dev, device_t **devlistp, int *devcountp)
return (0);
}
- list = mallocarray(count, sizeof(device_t), M_TEMP, M_NOWAIT|M_ZERO);
+ list = malloc(count * sizeof(device_t), M_TEMP, M_NOWAIT|M_ZERO);
if (!list)
return (ENOMEM);
diff --git a/sys/kern/subr_taskqueue.c b/sys/kern/subr_taskqueue.c
index f351ba73cc21..290a5c32d908 100644
--- a/sys/kern/subr_taskqueue.c
+++ b/sys/kern/subr_taskqueue.c
@@ -651,8 +651,8 @@ _taskqueue_start_threads(struct taskqueue **tqp, int count, int pri,
vsnprintf(ktname, sizeof(ktname), name, ap);
tq = *tqp;
- tq->tq_threads = mallocarray(count, sizeof(struct thread *),
- M_TASKQUEUE, M_NOWAIT | M_ZERO);
+ tq->tq_threads = malloc(sizeof(struct thread *) * count, M_TASKQUEUE,
+ M_NOWAIT | M_ZERO);
if (tq->tq_threads == NULL) {
printf("%s: no memory for %s threads\n", __func__, ktname);
return (ENOMEM);
diff --git a/sys/kern/subr_vmem.c b/sys/kern/subr_vmem.c
index 13c1b5163689..ef400c93b8d7 100644
--- a/sys/kern/subr_vmem.c
+++ b/sys/kern/subr_vmem.c
@@ -692,7 +692,7 @@ vmem_rehash(vmem_t *vm, vmem_size_t newhashsize)
MPASS(newhashsize > 0);
- newhashlist = mallocarray(newhashsize, sizeof(struct vmem_hashlist),
+ newhashlist = malloc(sizeof(struct vmem_hashlist) * newhashsize,
M_VMEM, M_NOWAIT);
if (newhashlist == NULL)
return ENOMEM;
diff --git a/sys/mips/mips/busdma_machdep.c b/sys/mips/mips/busdma_machdep.c
index 83d70b90a68f..e2f9e226c27d 100644
--- a/sys/mips/mips/busdma_machdep.c
+++ b/sys/mips/mips/busdma_machdep.c
@@ -345,8 +345,7 @@ _busdma_alloc_dmamap(bus_dma_tag_t dmat)
struct sync_list *slist;
bus_dmamap_t map;
- slist = mallocarray(dmat->nsegments, sizeof(*slist), M_BUSDMA,
- M_NOWAIT);
+ slist = malloc(sizeof(*slist) * dmat->nsegments, M_BUSDMA, M_NOWAIT);
if (slist == NULL)
return (NULL);
map = uma_zalloc_arg(dmamap_zone, dmat, M_NOWAIT);
@@ -535,9 +534,9 @@ bus_dmamap_create(bus_dma_tag_t dmat, int flags, bus_dmamap_t *mapp)
int error = 0;
if (dmat->segments == NULL) {
- dmat->segments =
- (bus_dma_segment_t *)mallocarray(dmat->nsegments,
- sizeof(bus_dma_segment_t), M_BUSDMA, M_NOWAIT);
+ dmat->segments = (bus_dma_segment_t *)malloc(
+ sizeof(bus_dma_segment_t) * dmat->nsegments, M_BUSDMA,
+ M_NOWAIT);
if (dmat->segments == NULL) {
CTR3(KTR_BUSDMA, "%s: tag %p error %d",
__func__, dmat, ENOMEM);
@@ -648,9 +647,9 @@ bus_dmamem_alloc(bus_dma_tag_t dmat, void** vaddrp, int flags,
else
mflags = M_WAITOK;
if (dmat->segments == NULL) {
- dmat->segments =
- (bus_dma_segment_t *)mallocarray(dmat->nsegments,
- sizeof(bus_dma_segment_t), M_BUSDMA, mflags);
+ dmat->segments = (bus_dma_segment_t *)malloc(
+ sizeof(bus_dma_segment_t) * dmat->nsegments, M_BUSDMA,
+ mflags);
if (dmat->segments == NULL) {
CTR4(KTR_BUSDMA, "%s: tag %p tag flags 0x%x error %d",
__func__, dmat, dmat->flags, ENOMEM);
diff --git a/sys/mips/nlm/dev/sec/nlmrsa.c b/sys/mips/nlm/dev/sec/nlmrsa.c
index 8ee0e64b7004..2c672675c48d 100644
--- a/sys/mips/nlm/dev/sec/nlmrsa.c
+++ b/sys/mips/nlm/dev/sec/nlmrsa.c
@@ -346,7 +346,7 @@ xlp_rsa_newsession(device_t dev, u_int32_t *sidp, struct cryptoini *cri)
if (ses == NULL) {
sesn = sc->sc_nsessions;
- ses = mallocarray(sesn + 1, sizeof(*ses),
+ ses = malloc((sesn + 1) * sizeof(*ses),
M_DEVBUF, M_NOWAIT);
if (ses == NULL)
return (ENOMEM);
@@ -528,9 +528,8 @@ xlp_rsa_kprocess(device_t dev, struct cryptkop *krp, int hint)
goto errout;
}
cmd->rsafn = 0; /* Mod Exp */
- cmd->rsasrc = mallocarray(
- krp->krp_iparams + krp->krp_oparams,
- cmd->rsaopsize,
+ cmd->rsasrc = malloc(
+ cmd->rsaopsize * (krp->krp_iparams + krp->krp_oparams),
M_DEVBUF,
M_NOWAIT | M_ZERO);
if (cmd->rsasrc == NULL) {
diff --git a/sys/net/if_vlan.c b/sys/net/if_vlan.c
index 83f2ac9288b2..43c44cade947 100644
--- a/sys/net/if_vlan.c
+++ b/sys/net/if_vlan.c
@@ -479,7 +479,7 @@ vlan_growhash(struct ifvlantrunk *trunk, int howmuch)
return;
/* M_NOWAIT because we're called with trunk mutex held */
- hash2 = mallocarray(n2, sizeof(struct ifvlanhead), M_VLAN, M_NOWAIT);
+ hash2 = malloc(sizeof(struct ifvlanhead) * n2, M_VLAN, M_NOWAIT);
if (hash2 == NULL) {
printf("%s: out of memory -- hash size not changed\n",
__func__);
diff --git a/sys/net/iflib.c b/sys/net/iflib.c
index 4813ce1f238b..ba7d2547ed1f 100644
--- a/sys/net/iflib.c
+++ b/sys/net/iflib.c
@@ -1550,15 +1550,15 @@ iflib_txsd_alloc(iflib_txq_t txq)
goto fail;
}
if (!(txq->ift_sds.ifsd_flags =
- (uint8_t *) mallocarray(scctx->isc_ntxd[txq->ift_br_offset],
- sizeof(uint8_t), M_IFLIB, M_NOWAIT | M_ZERO))) {
+ (uint8_t *) malloc(sizeof(uint8_t) *
+ scctx->isc_ntxd[txq->ift_br_offset], M_IFLIB, M_NOWAIT | M_ZERO))) {
device_printf(dev, "Unable to allocate tx_buffer memory\n");
err = ENOMEM;
goto fail;
}
if (!(txq->ift_sds.ifsd_m =
- (struct mbuf **) mallocarray(scctx->isc_ntxd[txq->ift_br_offset],
- sizeof(struct mbuf *), M_IFLIB, M_NOWAIT | M_ZERO))) {
+ (struct mbuf **) malloc(sizeof(struct mbuf *) *
+ scctx->isc_ntxd[txq->ift_br_offset], M_IFLIB, M_NOWAIT | M_ZERO))) {
device_printf(dev, "Unable to allocate tx_buffer memory\n");
err = ENOMEM;
goto fail;
@@ -1570,8 +1570,7 @@ iflib_txsd_alloc(iflib_txq_t txq)
return (0);
if (!(txq->ift_sds.ifsd_map =
- (bus_dmamap_t *) mallocarray(scctx->isc_ntxd[txq->ift_br_offset],
- sizeof(bus_dmamap_t), M_IFLIB, M_NOWAIT | M_ZERO))) {
+ (bus_dmamap_t *) malloc(sizeof(bus_dmamap_t) * scctx->isc_ntxd[txq->ift_br_offset], M_IFLIB, M_NOWAIT | M_ZERO))) {
device_printf(dev, "Unable to allocate tx_buffer map memory\n");
err = ENOMEM;
goto fail;
@@ -1727,22 +1726,22 @@ iflib_rxsd_alloc(iflib_rxq_t rxq)
goto fail;
}
if (!(fl->ifl_sds.ifsd_flags =
- (uint8_t *) mallocarray(scctx->isc_nrxd[rxq->ifr_fl_offset],
- sizeof(uint8_t), M_IFLIB, M_NOWAIT | M_ZERO))) {
+ (uint8_t *) malloc(sizeof(uint8_t) *
+ scctx->isc_nrxd[rxq->ifr_fl_offset], M_IFLIB, M_NOWAIT | M_ZERO))) {
device_printf(dev, "Unable to allocate tx_buffer memory\n");
err = ENOMEM;
goto fail;
}
if (!(fl->ifl_sds.ifsd_m =
- (struct mbuf **) mallocarray(scctx->isc_nrxd[rxq->ifr_fl_offset],
- sizeof(struct mbuf *), M_IFLIB, M_NOWAIT | M_ZERO))) {
+ (struct mbuf **) malloc(sizeof(struct mbuf *) *
+ scctx->isc_nrxd[rxq->ifr_fl_offset], M_IFLIB, M_NOWAIT | M_ZERO))) {
device_printf(dev, "Unable to allocate tx_buffer memory\n");
err = ENOMEM;
goto fail;
}
if (!(fl->ifl_sds.ifsd_cl =
- (caddr_t *) mallocarray(scctx->isc_nrxd[rxq->ifr_fl_offset],
- sizeof(caddr_t), M_IFLIB, M_NOWAIT | M_ZERO))) {
+ (caddr_t *) malloc(sizeof(caddr_t) *
+ scctx->isc_nrxd[rxq->ifr_fl_offset], M_IFLIB, M_NOWAIT | M_ZERO))) {
device_printf(dev, "Unable to allocate tx_buffer memory\n");
err = ENOMEM;
goto fail;
@@ -1754,8 +1753,7 @@ iflib_rxsd_alloc(iflib_rxq_t rxq)
continue;
if (!(fl->ifl_sds.ifsd_map =
- (bus_dmamap_t *) mallocarray(scctx->isc_nrxd[rxq->ifr_fl_offset],
- sizeof(bus_dmamap_t), M_IFLIB, M_NOWAIT | M_ZERO))) {
+ (bus_dmamap_t *) malloc(sizeof(bus_dmamap_t) * scctx->isc_nrxd[rxq->ifr_fl_offset], M_IFLIB, M_NOWAIT | M_ZERO))) {
device_printf(dev, "Unable to allocate tx_buffer map memory\n");
err = ENOMEM;
goto fail;
@@ -4747,8 +4745,8 @@ iflib_queues_alloc(if_ctx_t ctx)
/* Allocate the TX ring struct memory */
if (!(txq =
- (iflib_txq_t) mallocarray(ntxqsets, sizeof(struct iflib_txq),
- M_IFLIB, M_NOWAIT | M_ZERO))) {
+ (iflib_txq_t) malloc(sizeof(struct iflib_txq) *
+ ntxqsets, M_IFLIB, M_NOWAIT | M_ZERO))) {
device_printf(dev, "Unable to allocate TX ring memory\n");
err = ENOMEM;
goto fail;
@@ -4756,8 +4754,8 @@ iflib_queues_alloc(if_ctx_t ctx)
/* Now allocate the RX */
if (!(rxq =
- (iflib_rxq_t) mallocarray(nrxqsets, sizeof(struct iflib_rxq),
- M_IFLIB, M_NOWAIT | M_ZERO))) {
+ (iflib_rxq_t) malloc(sizeof(struct iflib_rxq) *
+ nrxqsets, M_IFLIB, M_NOWAIT | M_ZERO))) {
device_printf(dev, "Unable to allocate RX ring memory\n");
err = ENOMEM;
goto rx_fail;
@@ -4851,8 +4849,7 @@ iflib_queues_alloc(if_ctx_t ctx)
}
rxq->ifr_nfl = nfree_lists;
if (!(fl =
- (iflib_fl_t) mallocarray(nfree_lists, sizeof(struct iflib_fl),
- M_IFLIB, M_NOWAIT | M_ZERO))) {
+ (iflib_fl_t) malloc(sizeof(struct iflib_fl) * nfree_lists, M_IFLIB, M_NOWAIT | M_ZERO))) {
device_printf(dev, "Unable to allocate free list memory\n");
err = ENOMEM;
goto err_tx_desc;
diff --git a/sys/netgraph/ng_bridge.c b/sys/netgraph/ng_bridge.c
index 11462537e43b..a1e3f2658d38 100644
--- a/sys/netgraph/ng_bridge.c
+++ b/sys/netgraph/ng_bridge.c
@@ -907,7 +907,7 @@ ng_bridge_rehash(priv_p priv)
newMask = newNumBuckets - 1;
/* Allocate and initialize new table */
- newTab = mallocarray(newNumBuckets, sizeof(*newTab),
+ newTab = malloc(newNumBuckets * sizeof(*newTab),
M_NETGRAPH_BRIDGE, M_NOWAIT | M_ZERO);
if (newTab == NULL)
return;
diff --git a/sys/netgraph/ng_deflate.c b/sys/netgraph/ng_deflate.c
index bb6a1823b42c..9c0ab7a753e2 100644
--- a/sys/netgraph/ng_deflate.c
+++ b/sys/netgraph/ng_deflate.c
@@ -427,7 +427,7 @@ static void *
z_alloc(void *notused, u_int items, u_int size)
{
- return (mallocarray(items, size, M_NETGRAPH_DEFLATE, M_NOWAIT));
+ return (malloc(items * size, M_NETGRAPH_DEFLATE, M_NOWAIT));
}
static void
diff --git a/sys/netgraph/ng_parse.c b/sys/netgraph/ng_parse.c
index 466c01398102..b08cecd102e9 100644
--- a/sys/netgraph/ng_parse.c
+++ b/sys/netgraph/ng_parse.c
@@ -1207,8 +1207,7 @@ ng_parse_composite(const struct ng_parse_type *type, const char *s,
int align, len, blen, error = 0;
/* Initialize */
- foff = mallocarray(num, sizeof(*foff), M_NETGRAPH_PARSE,
- M_NOWAIT | M_ZERO);
+ foff = malloc(num * sizeof(*foff), M_NETGRAPH_PARSE, M_NOWAIT | M_ZERO);
if (foff == NULL) {
error = ENOMEM;
goto done;
diff --git a/sys/netinet6/in6_jail.c b/sys/netinet6/in6_jail.c
index d8b6462a9262..8e0de6615194 100644
--- a/sys/netinet6/in6_jail.c
+++ b/sys/netinet6/in6_jail.c
@@ -103,8 +103,8 @@ prison_restrict_ip6(struct prison *pr, struct in6_addr *newip6)
*/
used = 1;
if (newip6 == NULL) {
- newip6 = mallocarray(ppr->pr_ip6s,
- sizeof(*newip6), M_PRISON, M_NOWAIT);
+ newip6 = malloc(ppr->pr_ip6s * sizeof(*newip6),
+ M_PRISON, M_NOWAIT);
if (newip6 != NULL)
used = 0;
}
diff --git a/sys/powerpc/pseries/phyp_vscsi.c b/sys/powerpc/pseries/phyp_vscsi.c
index 4ee715a918c5..6c9c32f7bad9 100644
--- a/sys/powerpc/pseries/phyp_vscsi.c
+++ b/sys/powerpc/pseries/phyp_vscsi.c
@@ -336,8 +336,8 @@ vscsi_attach(device_t dev)
mtx_lock(&sc->io_lock);
vscsi_setup_bus(sc);
- sc->xfer = mallocarray(sc->max_transactions, sizeof(sc->xfer[0]),
- M_VSCSI, M_NOWAIT);
+ sc->xfer = malloc(sizeof(sc->xfer[0])*sc->max_transactions, M_VSCSI,
+ M_NOWAIT);
for (i = 0; i < sc->max_transactions; i++) {
xp = &sc->xfer[i];
xp->sc = sc;
diff --git a/sys/x86/cpufreq/est.c b/sys/x86/cpufreq/est.c
index f13eb86d7ddb..d83cc98154b9 100644
--- a/sys/x86/cpufreq/est.c
+++ b/sys/x86/cpufreq/est.c
@@ -1119,7 +1119,7 @@ est_acpi_info(device_t dev, freq_info **freqs)
goto out;
/* Parse settings into our local table format. */
- table = mallocarray(count + 1, sizeof(freq_info), M_DEVBUF, M_NOWAIT);
+ table = malloc((count + 1) * sizeof(freq_info), M_DEVBUF, M_NOWAIT);
if (table == NULL) {
error = ENOMEM;
goto out;