From: Xiaoke Wang Date: Wed, 30 Mar 2022 11:30:05 +0000 (+0800) Subject: staging: r8188eu: add a check for rtw_cbuf_alloc() X-Git-Tag: howlett/maple/20220722_2~355^2~313 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=9fcee167d81c4121b620b0a885f766007a41e841;p=users%2Fjedix%2Flinux-maple.git staging: r8188eu: add a check for rtw_cbuf_alloc() kmalloc() is called by rtw_cbuf_alloc() and it returns pointer of srtuct rtw_cbuf, NULL for allocation failure. So it is better to check the return value of it. Signed-off-by: Xiaoke Wang Link: https://lore.kernel.org/r/tencent_D95ACC78B93B1CDD14C4E13E4A66FF892008@qq.com Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/r8188eu/core/rtw_cmd.c b/drivers/staging/r8188eu/core/rtw_cmd.c index ccc43c0ba433..859ec8d8ad9e 100644 --- a/drivers/staging/r8188eu/core/rtw_cmd.c +++ b/drivers/staging/r8188eu/core/rtw_cmd.c @@ -69,6 +69,8 @@ static int _rtw_init_evt_priv(struct evt_priv *pevtpriv) INIT_WORK(&pevtpriv->c2h_wk, c2h_wk_callback); pevtpriv->c2h_wk_alive = false; pevtpriv->c2h_queue = rtw_cbuf_alloc(C2H_QUEUE_MAX_LEN + 1); + if (!pevtpriv->c2h_queue) + res = _FAIL; return res; }