diff options
author | Insu Yun <wuninsu@gmail.com> | 2015-12-30 17:01:44 +0100 |
---|---|---|
committer | Kalle Valo <kvalo@codeaurora.org> | 2016-01-07 10:11:51 +0100 |
commit | 50f85e220f6f51798429a3cc74e7c76d27513bef (patch) | |
tree | 2d69b20f74350f38e7470679eb0f9c088609393f /drivers/net/wireless/marvell/mwifiex | |
parent | iwlegacy: 4965-mac: constify il_sensitivity_ranges structure (diff) | |
download | linux-50f85e220f6f51798429a3cc74e7c76d27513bef.tar.xz linux-50f85e220f6f51798429a3cc74e7c76d27513bef.zip |
mwifiex: correctly handling kzalloc
Since kzalloc can be failed in memory pressure,
it needs to be handled, otherwise NULL dereference could be happened
Signed-off-by: Insu Yun <wuninsu@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Diffstat (limited to 'drivers/net/wireless/marvell/mwifiex')
-rw-r--r-- | drivers/net/wireless/marvell/mwifiex/sdio.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/net/wireless/marvell/mwifiex/sdio.c b/drivers/net/wireless/marvell/mwifiex/sdio.c index 78a8474e1a3d..a8af72d02c44 100644 --- a/drivers/net/wireless/marvell/mwifiex/sdio.c +++ b/drivers/net/wireless/marvell/mwifiex/sdio.c @@ -2053,8 +2053,19 @@ static int mwifiex_init_sdio(struct mwifiex_adapter *adapter) /* Allocate skb pointer buffers */ card->mpa_rx.skb_arr = kzalloc((sizeof(void *)) * card->mp_agg_pkt_limit, GFP_KERNEL); + if (!card->mpa_rx.skb_arr) { + kfree(card->mp_regs); + return -ENOMEM; + } + card->mpa_rx.len_arr = kzalloc(sizeof(*card->mpa_rx.len_arr) * card->mp_agg_pkt_limit, GFP_KERNEL); + if (!card->mpa_rx.len_arr) { + kfree(card->mp_regs); + kfree(card->mpa_rx.skb_arr); + return -ENOMEM; + } + ret = mwifiex_alloc_sdio_mpa_buffers(adapter, card->mp_tx_agg_buf_size, card->mp_rx_agg_buf_size); |