diff options
author | Pedro F. Giffuni <pfg@FreeBSD.org> | 2018-01-11 15:25:26 +0000 |
---|---|---|
committer | Pedro F. Giffuni <pfg@FreeBSD.org> | 2018-01-11 15:25:26 +0000 |
commit | efaa3e0789f4a44018d91ce2521d57453ce6eed9 (patch) | |
tree | 31988559d069b4923ad4f64bbb7e2cd621773d41 /sys/dev/ixl/ixl_pf_main.c | |
parent | e426794f61226dffdd8447d0709a0c48c51da73a (diff) | |
download | src-efaa3e0789f4a44018d91ce2521d57453ce6eed9.tar.gz src-efaa3e0789f4a44018d91ce2521d57453ce6eed9.zip |
dev/(e1000,ixl): Make some use of mallocarray(9).
Reviewed by: erj
Differential Revision: https://reviews.freebsd.org/D13833
Notes
Notes:
svn path=/head/; revision=327828
Diffstat (limited to 'sys/dev/ixl/ixl_pf_main.c')
-rw-r--r-- | sys/dev/ixl/ixl_pf_main.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/sys/dev/ixl/ixl_pf_main.c b/sys/dev/ixl/ixl_pf_main.c index fa271d434ec4..0028cc4bfe85 100644 --- a/sys/dev/ixl/ixl_pf_main.c +++ b/sys/dev/ixl/ixl_pf_main.c @@ -2431,8 +2431,8 @@ ixl_setup_stations(struct ixl_pf *pf) /* Get memory for the station queues */ if (!(vsi->queues = - (struct ixl_queue *) malloc(sizeof(struct ixl_queue) * - vsi->num_queues, M_DEVBUF, M_NOWAIT | M_ZERO))) { + (struct ixl_queue *) mallocarray(vsi->num_queues, + sizeof(struct ixl_queue), M_DEVBUF, M_NOWAIT | M_ZERO))) { device_printf(dev, "Unable to allocate queue memory\n"); error = ENOMEM; return (error); @@ -3317,7 +3317,7 @@ ixl_add_hw_filters(struct ixl_vsi *vsi, int flags, int cnt) hw = &pf->hw; IXL_PF_LOCK_ASSERT(pf); - a = malloc(sizeof(struct i40e_aqc_add_macvlan_element_data) * cnt, + a = mallocarray(cnt, sizeof(struct i40e_aqc_add_macvlan_element_data), M_DEVBUF, M_NOWAIT | M_ZERO); if (a == NULL) { device_printf(dev, "add_hw_filters failed to get memory\n"); @@ -3380,7 +3380,8 @@ ixl_del_hw_filters(struct ixl_vsi *vsi, int cnt) hw = &pf->hw; dev = pf->dev; - d = malloc(sizeof(struct i40e_aqc_remove_macvlan_element_data) * cnt, + d = mallocarray(cnt, + sizeof(struct i40e_aqc_remove_macvlan_element_data), M_DEVBUF, M_NOWAIT | M_ZERO); if (d == NULL) { printf("del hw filter failed to get memory\n"); |