diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2014-07-13 17:34:26 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2014-07-13 17:34:26 +0000 |
commit | 8734e42fda970c1ccf903d591056036bd38e621d (patch) | |
tree | bc92d9ca2fa7fbc61a7cf1218f58daff323d5438 /sys/scsi/ch.c | |
parent | 0fffc7585dd8555b2fcd57208624d1c748047ca8 (diff) |
use mallocarray where arguments are multiplied; ok tedu
Diffstat (limited to 'sys/scsi/ch.c')
-rw-r--r-- | sys/scsi/ch.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/sys/scsi/ch.c b/sys/scsi/ch.c index d00f1d0515c..818a0d0cbef 100644 --- a/sys/scsi/ch.c +++ b/sys/scsi/ch.c @@ -1,4 +1,4 @@ -/* $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 $ */ /* @@ -596,9 +596,10 @@ ch_usergetelemstatus(struct ch_softc *sc, 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) { |