All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] staging:rtl8192u: Check memory allocation
@ 2017-02-28 20:02 Georgiana Rodica Chelu
  2017-02-28 20:25 ` [Outreachy kernel] " Julia Lawall
  2017-03-01 21:32 ` Georgiana Chelu
  0 siblings, 2 replies; 3+ messages in thread
From: Georgiana Rodica Chelu @ 2017-02-28 20:02 UTC (permalink / raw)
  To: outreachy-kernel; +Cc: gregkh

Check if the allocation is not successful and
return the error code -ENOMEM.

Signed-off-by: Georgiana Rodica Chelu <georgiana.chelu93@gmail.com>
---
 drivers/staging/rtl8192u/r8192U_core.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c
index b631990..04025b6 100644
--- a/drivers/staging/rtl8192u/r8192U_core.c
+++ b/drivers/staging/rtl8192u/r8192U_core.c
@@ -1689,9 +1689,13 @@ static short rtl8192_usb_initendpoints(struct net_device *dev)
 #ifndef JACKSON_NEW_RX
 	for (i = 0; i < (MAX_RX_URB + 1); i++) {
 		priv->rx_urb[i] = usb_alloc_urb(0, GFP_KERNEL);
+		if (!priv->rx_urb[i])
+			return -ENOMEM;
 
 		priv->rx_urb[i]->transfer_buffer =
 			kmalloc(RX_URB_SIZE, GFP_KERNEL);
+		if (!priv->rx_urb[i]->transfer_buffer)
+			return -ENOMEM;
 
 		priv->rx_urb[i]->transfer_buffer_length = RX_URB_SIZE;
 	}
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-03-01 21:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-02-28 20:02 [PATCH] staging:rtl8192u: Check memory allocation Georgiana Rodica Chelu
2017-02-28 20:25 ` [Outreachy kernel] " Julia Lawall
2017-03-01 21:32 ` Georgiana Chelu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.