提交 6cc0c259 编写于 作者: C Colin Ian King 提交者: Greg Kroah-Hartman

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: NColin Ian King <colin.king@canonical.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 2af5f669
...@@ -1928,6 +1928,8 @@ static s32 Handle_Get_InActiveTime(struct wilc_vif *vif, ...@@ -1928,6 +1928,8 @@ static s32 Handle_Get_InActiveTime(struct wilc_vif *vif,
wid.type = WID_STR; wid.type = WID_STR;
wid.size = ETH_ALEN; wid.size = ETH_ALEN;
wid.val = kmalloc(wid.size, GFP_KERNEL); wid.val = kmalloc(wid.size, GFP_KERNEL);
if (!wid.val)
return -ENOMEM;
stamac = wid.val; stamac = wid.val;
ether_addr_copy(stamac, strHostIfStaInactiveT->mac); ether_addr_copy(stamac, strHostIfStaInactiveT->mac);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册