lkml.org 
[lkml]   [2023]   [Feb]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] staging: r8188eu: add a null check of kzalloc in go_add_group_info_attr
Date
kzalloc may fails, pdata_attr might be null and will cause
illegal address access later.

Signed-off-by: Kang Chen <void0red@gmail.com>
---
drivers/staging/r8188eu/core/rtw_p2p.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/drivers/staging/r8188eu/core/rtw_p2p.c b/drivers/staging/r8188eu/core/rtw_p2p.c
index 93d3c9c43..802e1170a 100644
--- a/drivers/staging/r8188eu/core/rtw_p2p.c
+++ b/drivers/staging/r8188eu/core/rtw_p2p.c
@@ -31,6 +31,8 @@ static u32 go_add_group_info_attr(struct wifidirect_info *pwdinfo, u8 *pbuf)
struct sta_priv *pstapriv = &padapter->stapriv;

pdata_attr = kzalloc(MAX_P2P_IE_LEN, GFP_KERNEL);
+ if (!pdata_attr)
+ return 0;

pstart = pdata_attr;
pcur = pdata_attr;
--
2.34.1
\
 
 \ /
  Last update: 2023-03-27 00:35    [W:0.055 / U:0.304 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site