mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 11:26:02 +09:00
staging: wilc1000: add check for kmalloc allocation failure.
[ Upstream commit 6cc0c259d0 ]
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: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
c2e4c685b3
commit
e6e7ba9d76
@@ -2179,6 +2179,8 @@ static s32 Handle_Get_InActiveTime(struct host_if_drv *hif_drv,
|
||||
wid.type = WID_STR;
|
||||
wid.size = ETH_ALEN;
|
||||
wid.val = kmalloc(wid.size, GFP_KERNEL);
|
||||
if (!wid.val)
|
||||
return -ENOMEM;
|
||||
|
||||
stamac = wid.val;
|
||||
memcpy(stamac, strHostIfStaInactiveT->mac, ETH_ALEN);
|
||||
|
||||
Reference in New Issue
Block a user