From: "Randy.Dunlap" <rddunlap@osdl.org>
To: jgarzik@pobox.com
Cc: netdev@oss.sgi.com
Subject: [janitor] tr/3c359: handle kmalloc failures during init
Date: Sun, 18 Jan 2004 21:15:58 -0800 [thread overview]
Message-ID: <20040118211558.7d85c1e2.rddunlap@osdl.org> (raw)
Hi,
Please apply to 2.6.current.
From: Pablo Menichini <pablo@menichini.com.ar>
and maximilian attems <janitor@sternwelten.at>
while looking at kj mails from 200212 and 200301
this patch slept through
originally from: Pablo Menichini <pablo@menichini.com.ar>
rediffed and compile tested
patch applies on plain 2.6.0
maximilian attems <janitor@sternwelten.at>
handle kmalloc failures during init
diff -puN drivers/net/tokenring/3c359.c~tr3c_kmalloc drivers/net/tokenring/3c359.c
linux-261-bk4-kj1-rddunlap/drivers/net/tokenring/3c359.c | 13 +++++++++++++
1 files changed, 13 insertions(+)
diff -puN drivers/net/tokenring/3c359.c~tr3c_kmalloc drivers/net/tokenring/3c359.c
--- linux-261-bk4-kj1/drivers/net/tokenring/3c359.c~tr3c_kmalloc 2004-01-16 16:03:29.000000000 -0800
+++ linux-261-bk4-kj1-rddunlap/drivers/net/tokenring/3c359.c 2004-01-16 16:03:29.000000000 -0800
@@ -642,7 +642,20 @@ static int xl_open(struct net_device *de
*/
/* These MUST be on 8 byte boundaries */
xl_priv->xl_tx_ring = kmalloc((sizeof(struct xl_tx_desc) * XL_TX_RING_SIZE) + 7, GFP_DMA | GFP_KERNEL) ;
+ if (xl_priv->xl_tx_ring == NULL) {
+ printk(KERN_WARNING "%s: Not enough memory to allocate rx buffers.\n",
+ dev->name);
+ free_irq(dev->irq,dev);
+ return -ENOMEM;
+ }
xl_priv->xl_rx_ring = kmalloc((sizeof(struct xl_rx_desc) * XL_RX_RING_SIZE) +7, GFP_DMA | GFP_KERNEL) ;
+ if (xl_priv->xl_tx_ring == NULL) {
+ printk(KERN_WARNING "%s: Not enough memory to allocate rx buffers.\n",
+ dev->name);
+ free_irq(dev->irq,dev);
+ kfree(xl_priv->xl_tx_ring);
+ return -ENOMEM;
+ }
memset(xl_priv->xl_tx_ring,0,sizeof(struct xl_tx_desc) * XL_TX_RING_SIZE) ;
memset(xl_priv->xl_rx_ring,0,sizeof(struct xl_rx_desc) * XL_RX_RING_SIZE) ;
_
--
~Randy
next reply other threads:[~2004-01-19 5:15 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-01-19 5:15 Randy.Dunlap [this message]
2004-02-19 0:29 ` [janitor] tr/3c359: handle kmalloc failures during init Jeff Garzik
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=20040118211558.7d85c1e2.rddunlap@osdl.org \
--to=rddunlap@osdl.org \
--cc=jgarzik@pobox.com \
--cc=netdev@oss.sgi.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).