From: David Chosrova <david.chosrova@libertysurf.fr>
To: gregkh@suse.de
Cc: devel@driverdev.osuosl.org, error27@gmail.com,
andreamrl@tiscali.it, linux-wireless@vger.kernel.org,
kernel-janitors@vger.kernel.org
Subject: [PATCH] Staging: rtl8192u: check return code kmalloc.
Date: Wed, 01 Dec 2010 12:42:16 +0000 [thread overview]
Message-ID: <20101201124216.GA28979@debian.home> (raw)
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>
---
Compiled
diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c
index 494f180..67ba8f7 100644
--- a/drivers/staging/rtl8192u/r8192U_core.c
+++ b/drivers/staging/rtl8192u/r8192U_core.c
@@ -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++){
WARNING: multiple messages have this Message-ID (diff)
From: David Chosrova <david.chosrova@libertysurf.fr>
To: gregkh@suse.de
Cc: devel@driverdev.osuosl.org, error27@gmail.com,
andreamrl@tiscali.it, linux-wireless@vger.kernel.org,
kernel-janitors@vger.kernel.org
Subject: [PATCH] Staging: rtl8192u: check return code kmalloc.
Date: Wed, 1 Dec 2010 13:42:16 +0100 [thread overview]
Message-ID: <20101201124216.GA28979@debian.home> (raw)
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>
---
Compiled
diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c
index 494f180..67ba8f7 100644
--- a/drivers/staging/rtl8192u/r8192U_core.c
+++ b/drivers/staging/rtl8192u/r8192U_core.c
@@ -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++){
next reply other threads:[~2010-12-01 12:42 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-01 12:42 David Chosrova [this message]
2010-12-01 12:42 ` [PATCH] Staging: rtl8192u: check return code kmalloc David Chosrova
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20101201124216.GA28979@debian.home \
--to=david.chosrova@libertysurf.fr \
--cc=andreamrl@tiscali.it \
--cc=devel@driverdev.osuosl.org \
--cc=error27@gmail.com \
--cc=gregkh@suse.de \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.