lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:	Thu, 28 Jun 2007 16:25:54 -0700
From:	Randy Dunlap <randy.dunlap@...cle.com>
To:	Matt Domsch <Matt_Domsch@...l.com>
Cc:	lkml <linux-kernel@...r.kernel.org>, gregkh@...e.de,
	linux-pci@...ey.karlin.mff.cuni.cz,
	akpm <akpm@...ux-foundation.org>
Subject: [PATCH] pci.h stubs (for EDD build error)

On Tue, 26 Jun 2007 21:45:05 -0500 Matt Domsch wrote:

> On Tue, Jun 26, 2007 at 01:26:22PM -0700, Randy Dunlap wrote:
> > Hi,
> > 
> > CONFIG_EDD does not depend on PCI, but edd.c uses pci_* interface
> > functions, resulting in:
> > 
> >   CC [M]  drivers/firmware/edd.o
> > drivers/firmware/edd.c: In function 'edd_get_pci_dev':
> > drivers/firmware/edd.c:672: warning: implicit declaration of function 'pci_get_bus_and_slot'
> > drivers/firmware/edd.c:673: warning: return makes pointer from integer without a cast
> > ...
> > ERROR: "pci_get_bus_and_slot" [drivers/firmware/edd.ko] undefined!
> > make[1]: *** [__modpost] Error 1
> > 
> > 
> > Should EDD depend on PCI or should some parts of edd.c be stubbed?
> 
> Good catch, thanks.
> 
> It should be stubbed, in include/linux/pci.h where all the other PCI
> functions are stubbed for the !CONFIG_PCI case.
> 
> There are several functions in include/linux/pci.h that have been
> added in the CONFIG_PCI case, but not stubbed in !CONFIG_PCI.
> pci_get_bus_and_slot() is just one of those.  That list appears to
> include:
> 
> struct pci_bus *pci_find_next_bus(const struct pci_bus *from);
> struct pci_dev *pci_get_slot (struct pci_bus *bus, unsigned int devfn);
> struct pci_dev *pci_get_bus_and_slot (unsigned int bus, unsigned int devfn);

Did those -- patch is below.

Get clean build of drivers/firmware/edd.c with this patch
even when CONFIG_PCI=n.


> Perhaps arguably, functions that take a struct pci_dev * as an
> argument need not be stubbed, as they shouldn't be called with a null
> pointer argument in the first place.  These include:
> 
> int pci_find_ht_capability (struct pci_dev *dev, int ht_cap);
> int pci_find_next_ht_capability (struct pci_dev *dev, int pos, int ht_cap);
> static inline int pci_is_managed(struct pci_dev *pdev)
> 
> 
> I'm out of the office this week and next, but will add to my (growing)
> list of cleanups to do when I'm back and more online, unless you or
> someone wants to get to it first. :-)



From: Randy Dunlap <randy.dunlap@...cle.com>

Provide stubs for more PCI bus/slot functions when CONFIG_PCI=n.

Signed-off-by: Randy Dunlap <randy.dunlap@...cle.com>
---
 include/linux/pci.h |   11 +++++++++++
 1 file changed, 11 insertions(+)

--- linux-2622-rc6.orig/include/linux/pci.h
+++ linux-2622-rc6/include/linux/pci.h
@@ -748,6 +748,17 @@ static inline void pci_release_regions(s
 static inline void pci_block_user_cfg_access(struct pci_dev *dev) { }
 static inline void pci_unblock_user_cfg_access(struct pci_dev *dev) { }
 
+static inline struct pci_bus *pci_find_next_bus(const struct pci_bus *from)
+{ return NULL; }
+
+static inline struct pci_dev *pci_get_slot(struct pci_bus *bus,
+						unsigned int devfn)
+{ return NULL; }
+
+static inline struct pci_dev *pci_get_bus_and_slot(unsigned int bus,
+						unsigned int devfn)
+{ return NULL; }
+
 #endif /* CONFIG_PCI */
 
 /* Include architecture-dependent settings and functions */
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists