aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/ciss
diff options
context:
space:
mode:
authorPedro F. Giffuni <pfg@FreeBSD.org>2018-01-21 15:42:36 +0000
committerPedro F. Giffuni <pfg@FreeBSD.org>2018-01-21 15:42:36 +0000
commitac2fffa4b74cd83963f0d462c379c7f50eeabf20 (patch)
tree1f8fc635121499d467998c99ece5983a2d563840 /sys/dev/ciss
parente09304d8f33887be9cc37817885061ccbb770d50 (diff)
downloadsrc-ac2fffa4b74cd83963f0d462c379c7f50eeabf20.tar.gz
src-ac2fffa4b74cd83963f0d462c379c7f50eeabf20.zip
Revert r327828, r327949, r327953, r328016-r328026, r328041:
Uses of mallocarray(9). The use of mallocarray(9) has rocketed the required swap to build FreeBSD. This is likely caused by the allocation size attributes which put extra pressure on the compiler. Given that most of these checks are superfluous we have to choose better where to use mallocarray(9). We still have more uses of mallocarray(9) but hopefully this is enough to bring swap usage to a reasonable level. Reported by: wosch PR: 225197
Notes
Notes: svn path=/head/; revision=328218
Diffstat (limited to 'sys/dev/ciss')
-rw-r--r--sys/dev/ciss/ciss.c10
1 files changed, 5 insertions, 5 deletions
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");