summaryrefslogtreecommitdiff
path: root/sys/dev/acpi
diff options
context:
space:
mode:
authorDoug Hogan <doug@cvs.openbsd.org>2014-12-09 06:58:30 +0000
committerDoug Hogan <doug@cvs.openbsd.org>2014-12-09 06:58:30 +0000
commitad90d9845d96f21749e3776b0296938c6d60ca9a (patch)
treeca999709d208d683272d9911f2706d59a203748f /sys/dev/acpi
parent7ac588b8eb1d276029001886214facee144b2fc5 (diff)
Replace some malloc(n*size,...) calls with mallocarray().
ok tedu@ deraadt@
Diffstat (limited to 'sys/dev/acpi')
-rw-r--r--sys/dev/acpi/acpi.c4
-rw-r--r--sys/dev/acpi/acpicpu.c4
-rw-r--r--sys/dev/acpi/acpimadt.c5
-rw-r--r--sys/dev/acpi/acpivout.c4
4 files changed, 9 insertions, 8 deletions
diff --git a/sys/dev/acpi/acpi.c b/sys/dev/acpi/acpi.c
index 00817d59118..7c8b449b187 100644
--- a/sys/dev/acpi/acpi.c
+++ b/sys/dev/acpi/acpi.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: acpi.c,v 1.276 2014/12/06 11:10:56 mpi Exp $ */
+/* $OpenBSD: acpi.c,v 1.277 2014/12/09 06:58:29 doug Exp $ */
/*
* Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com>
* Copyright (c) 2005 Jordan Hargrave <jordan@openbsd.org>
@@ -1960,7 +1960,7 @@ acpi_init_gpes(struct acpi_softc *sc)
dnprintf(50, "Last GPE: %.2x\n", sc->sc_lastgpe);
/* Allocate GPE table */
- sc->gpe_table = malloc(sc->sc_lastgpe * sizeof(struct gpe_block),
+ sc->gpe_table = mallocarray(sc->sc_lastgpe, sizeof(struct gpe_block),
M_DEVBUF, M_WAITOK | M_ZERO);
ngpe = 0;
diff --git a/sys/dev/acpi/acpicpu.c b/sys/dev/acpi/acpicpu.c
index 3aee7f2d3ae..e2016024ee5 100644
--- a/sys/dev/acpi/acpicpu.c
+++ b/sys/dev/acpi/acpicpu.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: acpicpu.c,v 1.61 2014/09/14 14:17:24 jsg Exp $ */
+/* $OpenBSD: acpicpu.c,v 1.62 2014/12/09 06:58:29 doug Exp $ */
/*
* Copyright (c) 2005 Marco Peereboom <marco@openbsd.org>
*
@@ -607,7 +607,7 @@ acpicpu_getpss(struct acpicpu_softc *sc)
if (sc->sc_pss)
free(sc->sc_pss, M_DEVBUF, 0);
- sc->sc_pss = malloc(res.length * sizeof *sc->sc_pss, M_DEVBUF,
+ sc->sc_pss = mallocarray(res.length, sizeof(*sc->sc_pss), M_DEVBUF,
M_WAITOK | M_ZERO);
c = 0;
diff --git a/sys/dev/acpi/acpimadt.c b/sys/dev/acpi/acpimadt.c
index c285986c09c..1c8a9e49c3f 100644
--- a/sys/dev/acpi/acpimadt.c
+++ b/sys/dev/acpi/acpimadt.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: acpimadt.c,v 1.29 2014/07/12 18:48:17 tedu Exp $ */
+/* $OpenBSD: acpimadt.c,v 1.30 2014/12/09 06:58:29 doug Exp $ */
/*
* Copyright (c) 2006 Mark Kettenis <kettenis@openbsd.org>
*
@@ -294,7 +294,8 @@ acpimadt_attach(struct device *parent, struct device *self, void *aux)
addr += entry->madt_lapic.length;
}
- mp_intrs = malloc(nlapic_nmis * sizeof (struct mp_intr_map), M_DEVBUF, M_NOWAIT);
+ mp_intrs = mallocarray(nlapic_nmis, sizeof(struct mp_intr_map),
+ M_DEVBUF, M_NOWAIT);
if (mp_intrs == NULL)
return;
diff --git a/sys/dev/acpi/acpivout.c b/sys/dev/acpi/acpivout.c
index e383001a137..ccb1d787241 100644
--- a/sys/dev/acpi/acpivout.c
+++ b/sys/dev/acpi/acpivout.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: acpivout.c,v 1.9 2011/05/23 11:58:03 pirofti Exp $ */
+/* $OpenBSD: acpivout.c,v 1.10 2014/12/09 06:58:29 doug Exp $ */
/*
* Copyright (c) 2009 Paul Irofti <pirofti@openbsd.org>
*
@@ -283,7 +283,7 @@ acpivout_get_bcl(struct acpivout_softc *sc)
}
sc->sc_bcl_len = res.length - 2;
- sc->sc_bcl = malloc(sc->sc_bcl_len * sizeof(int), M_DEVBUF,
+ sc->sc_bcl = mallocarray(sc->sc_bcl_len, sizeof(int), M_DEVBUF,
M_WAITOK | M_ZERO);
for (i = 0; i < sc->sc_bcl_len; i++) {