[PATCH] staging: rtl8188eu: Fix potential NULL pointer dereference
From: Aditya Pakki
Date: Wed Mar 13 2019 - 13:11:45 EST
hwxmits is allocated via kcalloc and not checked for failure before its
dereference. The patch fixes this problem similar to rtl8723bs.
Signed-off-by: Aditya Pakki <pakki001@xxxxxxx>
---
drivers/staging/rtl8188eu/core/rtw_xmit.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/staging/rtl8188eu/core/rtw_xmit.c b/drivers/staging/rtl8188eu/core/rtw_xmit.c
index 1723a47a96b4..a557ed37923a 100644
--- a/drivers/staging/rtl8188eu/core/rtw_xmit.c
+++ b/drivers/staging/rtl8188eu/core/rtw_xmit.c
@@ -1512,6 +1512,10 @@ void rtw_alloc_hwxmits(struct adapter *padapter)
pxmitpriv->hwxmits = kcalloc(pxmitpriv->hwxmit_entry,
sizeof(struct hw_xmit), GFP_KERNEL);
+ if (!pxmitpriv->hwxmits) {
+ DBG_88E("alloc hwxmits fail!...\n");
+ return;
+ }
hwxmits = pxmitpriv->hwxmits;
--
2.17.1