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

Commit 6cc0c259 authored by Colin Ian King's avatar Colin Ian King Committed by Greg Kroah-Hartman
Browse files

staging: wilc1000: add check for kmalloc allocation failure.



Add a sanity check that wid.val has been allocated, fixes a null
pointer deference on stamac when calling ether_add_copy.

Detected by CoverityScan, CID#1369537 ("Dereference null return value")

Signed-off-by: default avatarColin Ian King <colin.king@canonical.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 2af5f669
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -1928,6 +1928,8 @@ static s32 Handle_Get_InActiveTime(struct wilc_vif *vif,
	wid.type = WID_STR;
	wid.size = ETH_ALEN;
	wid.val = kmalloc(wid.size, GFP_KERNEL);
	if (!wid.val)
		return -ENOMEM;

	stamac = wid.val;
	ether_addr_copy(stamac, strHostIfStaInactiveT->mac);