mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Rusty Trivial Russell <rusty@rustcorp.com.au>
To: torvalds@transmeta.com, linux-kernel@vger.kernel.org
Subject: [TRIVIAL] Handle kmalloc fails: drivers_pci_probe.c
Date: Mon, 06 Jan 2003 15:00:08 +1100	[thread overview]
Message-ID: <20030106041151.825982C267@lists.samba.org> (raw)

[ Looks trivially correct --RR ]
From:  Pablo Menichini <pablo@menichini.com.ar>

  Best regards,
          Pablo
  

--- trivial-2.5-bk/drivers/pci/probe.c.orig	2003-01-06 14:10:57.000000000 +1100
+++ trivial-2.5-bk/drivers/pci/probe.c	2003-01-06 14:10:57.000000000 +1100
@@ -558,9 +558,15 @@
 	b = pci_alloc_bus();
 	if (!b)
 		return NULL;
+	
+	b->dev = kmalloc(sizeof(*(b->dev)),GFP_KERNEL);
+	if (!b->dev){
+		kfree(b);
+		return NULL;
+	}
+	
 	list_add_tail(&b->node, &pci_root_buses);
 
-	b->dev = kmalloc(sizeof(*(b->dev)),GFP_KERNEL);
 	memset(b->dev,0,sizeof(*(b->dev)));
 	sprintf(b->dev->bus_id,"pci%d",bus);
 	strcpy(b->dev->name,"Host/PCI Bridge");
-- 
  Don't blame me: the Monkey is driving
  File: Pablo Menichini <pablo@menichini.com.ar>: [PATCH][2.5.53] Handle kmalloc fails: drivers_pci_probe.c

                 reply	other threads:[~2003-01-06  4:03 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20030106041151.825982C267@lists.samba.org \
    --to=rusty@rustcorp.com.au \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@transmeta.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

Powered by JetHome