Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 10 Jan 2018 20:05:19 +0000 (UTC)
From:      "Pedro F. Giffuni" <pfg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r327782 - head/sys/dev/bxe
Message-ID:  <201801102005.w0AK5JRv091356@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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)
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201801102005.w0AK5JRv091356>