Staging: rtl8712: fix potential null pointer dereference
PATCH 1/1 Staging: rtl8712: fix potential null pointer dereference
From: Matteo Semenzato <[email protected]>
Check if kmalloc succeded before using the pointer in memcpy.
Signed-off-by Matteo Semenzato <[email protected]>
--- drivers/staging/rtl8712/rtl871x_mlme.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/staging/rtl8712/rtl871x_mlme.c +2 -0
@@ -727,6 +727,8 @@ void r8712_joinbss_event_callback(struct _adapter *adapter, u8 *pbuf)if (sizeof (struct list_head ) ==4 *sizeof (u32)) { pnetwork =kmalloc (sizeof (struct wlan_network ),GFP_ATOMIC ); +if (!pnetwork) +return ;memcpy ((u8 *)pnetwork+16 , (u8 *)pbuf +8 ,sizeof (struct wlan_network ) -16 ); }else
Signature · 1 line
2.3.2