From: Greg KH <greg@kroah.com>
To: linux-kernel@vger.kernel.org
Subject: [PATCH] PCI fixes for 2.5.62
Date: Thu, 20 Feb 2003 16:44:25 -0800 [thread overview]
Message-ID: <20030221004424.GB26723@kroah.com> (raw)
In-Reply-To: <20030221004344.GA26723@kroah.com>
ChangeSet 1.1003, 2003/02/20 14:23:27-08:00, greg@kroah.com
[PATCH] PCI: remove large stack usage in pci_do_scan_bus()
diff -Nru a/drivers/pci/probe.c b/drivers/pci/probe.c
--- a/drivers/pci/probe.c Thu Feb 20 16:46:35 2003
+++ b/drivers/pci/probe.c Thu Feb 20 16:46:35 2003
@@ -505,23 +505,30 @@
{
unsigned int devfn, max, pass;
struct list_head *ln;
- struct pci_dev *dev, dev0;
+ struct pci_dev *dev;
+
+ dev = kmalloc(sizeof(*dev), GFP_KERNEL);
+ if (!dev) {
+ printk(KERN_ERR "Out of memory in %s\n", __FUNCTION__);
+ return 0;
+ }
DBG("Scanning bus %02x\n", bus->number);
max = bus->secondary;
/* Create a device template */
- memset(&dev0, 0, sizeof(dev0));
- dev0.bus = bus;
- dev0.sysdata = bus->sysdata;
- dev0.dev.parent = bus->dev;
- dev0.dev.bus = &pci_bus_type;
+ memset(dev, 0, sizeof(*dev));
+ dev->bus = bus;
+ dev->sysdata = bus->sysdata;
+ dev->dev.parent = bus->dev;
+ dev->dev.bus = &pci_bus_type;
/* Go find them, Rover! */
for (devfn = 0; devfn < 0x100; devfn += 8) {
- dev0.devfn = devfn;
- pci_scan_slot(&dev0);
+ dev->devfn = devfn;
+ pci_scan_slot(dev);
}
+ kfree(dev);
/*
* After performing arch-dependent fixup of the bus, look behind
next prev parent reply other threads:[~2003-02-21 0:41 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-02-21 0:43 [BK PATCH] PCI fixes for 2.5.62 Greg KH
2003-02-21 0:44 ` Greg KH [this message]
2003-02-21 0:44 ` [PATCH] " Greg KH
2003-02-21 0:45 ` Greg KH
2003-02-21 0:45 ` Greg KH
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=20030221004424.GB26723@kroah.com \
--to=greg@kroah.com \
--cc=linux-kernel@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox