summaryrefslogtreecommitdiffstats
path: root/drivers/staging/rtl8192u
diff options
context:
space:
mode:
authorColin Ian King2018-02-28 12:28:49 +0100
committerGreg Kroah-Hartman2018-03-01 17:26:13 +0100
commite1a7418529e33bc4efc346324557251a16a3e79b (patch)
tree39ebc19e53a5fd5d20f01361e2321ba51af1bf40 /drivers/staging/rtl8192u
parentstaging: wilc1000: rename WILC_WFI_mgmt_rx() to avoid camelCase (diff)
downloadkernel-qcow2-linux-e1a7418529e33bc4efc346324557251a16a3e79b.tar.gz
kernel-qcow2-linux-e1a7418529e33bc4efc346324557251a16a3e79b.tar.xz
kernel-qcow2-linux-e1a7418529e33bc4efc346324557251a16a3e79b.zip
staging: rtl8192u: return -ENOMEM on failed allocation of priv->oldaddr
Currently the allocation of priv->oldaddr is not null checked which will lead to subsequent errors when accessing priv->oldaddr. Fix this with a null pointer check and a return of -ENOMEM on allocation failure. Detected with Coccinelle: drivers/staging/rtl8192u/r8192U_core.c:1708:2-15: alloc with no test, possible model on line 1723 Fixes: 8fc8598e61f6 ("Staging: Added Realtek rtl8192u driver to staging") Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/rtl8192u')
-rw-r--r--drivers/staging/rtl8192u/r8192U_core.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c
index 3c300f7b6a62..d607c59761cf 100644
--- a/drivers/staging/rtl8192u/r8192U_core.c
+++ b/drivers/staging/rtl8192u/r8192U_core.c
@@ -1706,6 +1706,8 @@ static short rtl8192_usb_initendpoints(struct net_device *dev)
priv->rx_urb[16] = usb_alloc_urb(0, GFP_KERNEL);
priv->oldaddr = kmalloc(16, GFP_KERNEL);
+ if (!priv->oldaddr)
+ return -ENOMEM;
oldaddr = priv->oldaddr;
align = ((long)oldaddr) & 3;
if (align) {