Linux MIPS Architecture development
 help / color / mirror / Atom feed
* [PATCH] pci_alloc_consistent() crash
@ 2003-05-23 13:51 Geert Uytterhoeven
  2003-05-27  4:18 ` Ralf Baechle
  0 siblings, 1 reply; 2+ messages in thread
From: Geert Uytterhoeven @ 2003-05-23 13:51 UTC (permalink / raw)
  To: Ralf Baechle; +Cc: Linux/MIPS Development

	Hi Ralf,

Avoid a NULL-pointer dereference when using pci_alloc_consistent() for PCI-like
buses (i.e. hwdev = NULL).

--- linux-mips-2.4.x/arch/mips/kernel/pci-dma.c	Tue Apr  1 16:21:18 2003
+++ linux/arch/mips/kernel/pci-dma.c	Thu May 15 18:17:35 2003
@@ -21,6 +21,7 @@
 {
 	void *ret;
 	int gfp = GFP_ATOMIC;
+	struct pci_bus *bus = NULL;
 
 #ifdef CONFIG_ISA
 	if (hwdev == NULL || hwdev->dma_mask != 0xffffffff)
@@ -30,7 +31,9 @@
 
 	if (ret != NULL) {
 		memset(ret, 0, size);
-		*dma_handle = bus_to_baddr(hwdev->bus, __pa(ret));
+		if (hwdev)
+			bus = hwdev->bus;
+		*dma_handle = bus_to_baddr(bus, __pa(ret));
 #ifdef CONFIG_NONCOHERENT_IO
 		dma_cache_wback_inv((unsigned long) ret, size);
 		ret = UNCAC_ADDR(ret);

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-05-27  4:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-05-23 13:51 [PATCH] pci_alloc_consistent() crash Geert Uytterhoeven
2003-05-27  4:18 ` Ralf Baechle

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox