Commit 50f85e22 authored by Insu Yun's avatar Insu Yun Committed by Kalle Valo

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: default avatarInsu Yun <wuninsu@gmail.com>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
parent 9ec855cc
......@@ -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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment