Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 66faa441 authored by Matteo Semenzato's avatar Matteo Semenzato Committed by Greg Kroah-Hartman
Browse files

Staging: rtl8712: fix potential null pointer dereference



Check if kmalloc succeded before using the pointer in memcpy.

Signed-off-by: default avatarMatteo Semenzato <mattew8898@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 819ef638
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -725,6 +725,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