-/* $OpenBSD: ch.c,v 1.47 2014/07/12 18:50:25 tedu Exp $ */
+/* $OpenBSD: ch.c,v 1.48 2014/07/13 17:34:25 deraadt Exp $ */
/* $NetBSD: ch.c,v 1.26 1997/02/21 22:06:52 thorpej Exp $ */
/*
error = EINVAL;
goto done;
}
- udsize = avail * sizeof(struct changer_element_status);
- user_data = malloc(udsize, M_DEVBUF, M_WAITOK | M_ZERO);
+ user_data = mallocarray(avail, sizeof(struct changer_element_status),
+ M_DEVBUF, M_WAITOK | M_ZERO);
+ udsize = avail * sizeof(struct changer_element_status);
desc = (caddr_t)(pg_hdr + 1);
for (i = 0; i < avail; ++i) {
-/* $OpenBSD: safte.c,v 1.49 2014/07/12 18:50:25 tedu Exp $ */
+/* $OpenBSD: safte.c,v 1.50 2014/07/13 17:34:25 deraadt Exp $ */
/*
* Copyright (c) 2005 David Gwynne <dlg@openbsd.org>
sc->sc_nsensors = config->nfans + config->npwrsup + config->ntemps +
(config->doorlock ? 1 : 0) + (config->alarm ? 1 : 0);
- sc->sc_sensors = malloc(sc->sc_nsensors * sizeof(struct safte_sensor),
+ sc->sc_sensors = mallocarray(sc->sc_nsensors, sizeof(struct safte_sensor),
M_DEVBUF, M_NOWAIT | M_ZERO);
if (sc->sc_sensors == NULL) {
dma_free(sc->sc_encbuf, sc->sc_encbuflen);