dev/bxe: make use of mallocarray(9).

Use mallocarray in a couple of cases where a calloc-like operation is
taking place.
This commit is contained in:
Pedro F. Giffuni 2018-01-10 20:05:19 +00:00
parent 802258f46b
commit c93a33340f
2 changed files with 3 additions and 2 deletions

View File

@ -12018,7 +12018,8 @@ bxe_set_mc_list(struct bxe_softc *sc)
}
bzero(mta, (sizeof(unsigned char) * ETHER_ADDR_LEN * mc_count));
mc_mac = malloc(sizeof(*mc_mac) * mc_count, M_DEVBUF, (M_NOWAIT | M_ZERO));
mc_mac = mallocarray(mc_count, sizeof(*mc_mac), M_DEVBUF,
(M_NOWAIT | M_ZERO));
mc_mac_start = mc_mac;
if (!mc_mac) {

View File

@ -159,7 +159,7 @@ typedef struct mtx ECORE_MUTEX_SPIN;
malloc(_size, M_TEMP, (M_NOWAIT | M_ZERO))
#define ECORE_CALLOC(_len, _size, _flags, _sc) \
malloc(_len * _size, M_TEMP, (M_NOWAIT | M_ZERO))
mallocarray(_len, _size, M_TEMP, (M_NOWAIT | M_ZERO))
#define ECORE_FREE(_s, _buf, _size) free(_buf, M_TEMP)