On Sun, Jul 13, 2014 at 11:29:22AM -0600, dera...@cvs.openbsd.org wrote:
> This is the first pass of mallocarray() in sys/dev. Please proofread.
[...]
> ===
> RCS file: /cvs/src/sys/dev/softraid.c,v
> retrieving revision 1.334
> diff
> > 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.
And fix the inter
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 her
On Sun, Jul 13, 2014 at 11:29:22AM -0600, dera...@cvs.openbsd.org wrote:
> - ldp = malloc(sizeof(*ldp) + (k-1), M_DEVBUF, M_NOWAIT);
> + ldp = mallocarray(k-1, sizeof(*ldp), M_DEVBUF, M_NOWAIT);
Are you sure k-1 can never be small enough such that a*b is less than a+b?
This is the first pass of mallocarray() in sys/dev. Please proofread.
Index: rd.c
===
RCS file: /cvs/src/sys/dev/rd.c,v
retrieving revision 1.7
diff -u -p -u -r1.7 rd.c
--- rd.c12 Jul 2014 18:48:51 - 1.7
+++ rd.c