Staging: rtl8192u: check return code kmalloc.
authorDavid Chosrova <david.chosrova@libertysurf.fr>
Wed, 1 Dec 2010 12:42:16 +0000 (13:42 +0100)
committerGreg Kroah-Hartman <gregkh@suse.de>
Wed, 1 Dec 2010 22:53:34 +0000 (14:53 -0800)
This patch checks the return code of  kmalloc when trying to allocate
memory for priv->rx_urb in rtl8192_usb_initendpoints(), return -ENOMEM
when failed.

Signed-off-by: David Chosrova <david.chosrova@libertysurf.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/staging/rtl8192u/r8192U_core.c

index 9cd41b698161e46fe0f8451d85d831ebd3c614dc..ae4f2b9d9e8f6df0d211c74ea2556fd76f56ed1d 100644 (file)
@@ -2198,6 +2198,8 @@ short rtl8192_usb_initendpoints(struct net_device *dev)
 
        priv->rx_urb = kmalloc(sizeof(struct urb *) * (MAX_RX_URB+1),
                                GFP_KERNEL);
+       if (priv->rx_urb == NULL)
+               return -ENOMEM;
 
 #ifndef JACKSON_NEW_RX
        for(i=0;i<(MAX_RX_URB+1);i++){