diff options
author | Pedro F. Giffuni <pfg@FreeBSD.org> | 2018-01-21 15:42:36 +0000 |
---|---|---|
committer | Pedro F. Giffuni <pfg@FreeBSD.org> | 2018-01-21 15:42:36 +0000 |
commit | ac2fffa4b74cd83963f0d462c379c7f50eeabf20 (patch) | |
tree | 1f8fc635121499d467998c99ece5983a2d563840 /sys/gnu/dev | |
parent | e09304d8f33887be9cc37817885061ccbb770d50 (diff) |
Revert r327828, r327949, r327953, r328016-r328026, r328041:
Uses of mallocarray(9).
The use of mallocarray(9) has rocketed the required swap to build FreeBSD.
This is likely caused by the allocation size attributes which put extra pressure
on the compiler.
Given that most of these checks are superfluous we have to choose better
where to use mallocarray(9). We still have more uses of mallocarray(9) but
hopefully this is enough to bring swap usage to a reasonable level.
Reported by: wosch
PR: 225197
Notes
Notes:
svn path=/head/; revision=328218
Diffstat (limited to 'sys/gnu/dev')
-rw-r--r-- | sys/gnu/dev/bwn/phy_n/if_bwn_phy_n_core.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/sys/gnu/dev/bwn/phy_n/if_bwn_phy_n_core.c b/sys/gnu/dev/bwn/phy_n/if_bwn_phy_n_core.c index 1fe47a9b40da..0e1291ea39b3 100644 --- a/sys/gnu/dev/bwn/phy_n/if_bwn_phy_n_core.c +++ b/sys/gnu/dev/bwn/phy_n/if_bwn_phy_n_core.c @@ -1620,7 +1620,7 @@ static int bwn_nphy_load_samples(struct bwn_mac *mac, uint16_t i; uint32_t *data; - data = mallocarray(len, sizeof(uint32_t), M_DEVBUF, M_NOWAIT | M_ZERO); + data = malloc(len * sizeof(uint32_t), M_DEVBUF, M_NOWAIT | M_ZERO); if (!data) { BWN_ERRPRINTF(mac->mac_sc, "allocation for samples loading failed\n"); return -ENOMEM; @@ -1663,8 +1663,7 @@ static uint16_t bwn_nphy_gen_load_samples(struct bwn_mac *mac, uint32_t freq, ui len = bw << 1; } - samples = mallocarray(len, sizeof(struct bwn_c32), M_DEVBUF, - M_NOWAIT | M_ZERO); + samples = malloc(len * sizeof(struct bwn_c32), M_DEVBUF, M_NOWAIT | M_ZERO); if (!samples) { BWN_ERRPRINTF(mac->mac_sc, "allocation for samples generation failed\n"); return 0; |