And some cosmetic things: > Index: ic/malo.c > - ring->data = malloc(count * sizeof (struct malo_rx_data), M_DEVBUF, > - M_NOWAIT); > + ring->data = mallocarray(count, sizeof (struct malo_rx_data), > + M_DEVBUF, M_NOWAIT);
Might as well s/sizeof (/sizeof(/ while you're here. > Index: ic/qla.c > - sc->sc_ccbs = malloc(sizeof(struct qla_ccb) * sc->sc_maxcmds, > + sc->sc_ccbs = mallocarray(sizeof(struct qla_ccb), sc->sc_maxcmds, Wrong order. > Index: ic/qlw.c > - sc->sc_ccbs = malloc(sizeof(struct qlw_ccb) * sc->sc_maxccbs, > + sc->sc_ccbs = mallocarray(sizeof(struct qlw_ccb), sc->sc_maxccbs, Wrong order. > Index: ic/rt2560.c > @@ -388,8 +388,8 @@ rt2560_alloc_tx_ring(struct rt2560_softc > - ring->data = malloc(count * sizeof (struct rt2560_tx_data), M_DEVBUF, > - M_NOWAIT | M_ZERO); > + ring->data = mallocarray(count, sizeof (struct rt2560_tx_data), > + M_DEVBUF, M_NOWAIT | M_ZERO); sizeof ( > @@ -532,8 +532,8 @@ rt2560_alloc_rx_ring(struct rt2560_softc > - ring->data = malloc(count * sizeof (struct rt2560_rx_data), M_DEVBUF, > - M_NOWAIT | M_ZERO); > + ring->data = mallocarray(count, sizeof (struct rt2560_rx_data), > + M_DEVBUF, M_NOWAIT | M_ZERO); sizeof ( > Index: ic/rt2661.c > @@ -473,8 +473,8 @@ rt2661_alloc_tx_ring(struct rt2661_softc > - ring->data = malloc(count * sizeof (struct rt2661_tx_data), M_DEVBUF, > - M_NOWAIT | M_ZERO); > + ring->data = mallocarray(count, sizeof (struct rt2661_tx_data), > + M_DEVBUF, M_NOWAIT | M_ZERO); sizeof ( > @@ -614,8 +614,8 @@ rt2661_alloc_rx_ring(struct rt2661_softc > - ring->data = malloc(count * sizeof (struct rt2661_rx_data), M_DEVBUF, > - M_NOWAIT | M_ZERO); > + ring->data = mallocarray(count, sizeof (struct rt2661_rx_data), > + M_DEVBUF, M_NOWAIT | M_ZERO); sizeof ( > Index: ic/siop.c > - newcbd->cmds = malloc(sizeof(struct siop_cmd) * SIOP_NCMDPB, > + newcbd->cmds = mallocarray(sizeof(struct siop_cmd), SIOP_NCMDPB, Wrong order. > Index: pci/agp.c > - segs = malloc(nseg * sizeof *segs, M_AGP, M_WAITOK); > + segs = mallocarray(nseg, sizeof *segs, M_AGP, M_WAITOK); sizeof(*segs) > Index: pci/hifn7751.c > - ses = (struct hifn_session *)malloc((sesn + 1) * > - sizeof(*ses), M_DEVBUF, M_NOWAIT); > + ses = mallocarray((sesn + 1), sizeof(*ses), > + M_DEVBUF, M_NOWAIT); useless () > Index: pci/mpii.c > - sc->sc_ccbs = malloc(sizeof(*ccb) * (sc->sc_max_cmds-1), > + sc->sc_ccbs = mallocarray((sc->sc_max_cmds-1), sizeof(*ccb), mallocarray(sc->sc_max_cmds - 1, ... > Index: pci/safe.c > - ses = (struct safe_session *)malloc((sesn + 1) * > + ses = mallocarray((sesn + 1), useless () > Index: pci/ubsec.c > - ses = (struct ubsec_session *)malloc((sesn + 1) * > + ses = mallocarray((sesn + 1), useless ()