Skip to contentSkip to conversation

Staging: rtl8192u: check return code kmalloc.

PATCH New David Chosrova 1 participant 1 message Dec 1, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Staging: rtl8192u: check return code kmalloc.

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.

---
Compiled

drivers/staging/rtl8192u/r8192U_core.c +2 -0
index 494f180..67ba8f7 100644
@@ -2203,6 +2203,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++){