svn commit: r327782 - head/sys/dev/bxe
Pedro F. Giffuni
pfg at FreeBSD.org
Wed Jan 10 20:05:21 UTC 2018
Author: pfg
Date: Wed Jan 10 20:05:19 2018
New Revision: 327782
URL: https://svnweb.freebsd.org/changeset/base/327782
Log:
dev/bxe: make use of mallocarray(9).
Use mallocarray in a couple of cases where a calloc-like operation is
taking place.
Modified:
head/sys/dev/bxe/bxe.c
head/sys/dev/bxe/ecore_sp.h
Modified: head/sys/dev/bxe/bxe.c
==============================================================================
--- head/sys/dev/bxe/bxe.c Wed Jan 10 19:45:38 2018 (r327781)
+++ head/sys/dev/bxe/bxe.c Wed Jan 10 20:05:19 2018 (r327782)
@@ -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) {
Modified: head/sys/dev/bxe/ecore_sp.h
==============================================================================
--- head/sys/dev/bxe/ecore_sp.h Wed Jan 10 19:45:38 2018 (r327781)
+++ head/sys/dev/bxe/ecore_sp.h Wed Jan 10 20:05:19 2018 (r327782)
@@ -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)
More information about the svn-src-all
mailing list