Messages in this thread | | | Date | Tue, 11 Jun 2002 17:00:51 -0600 (MDT) | From | Thunder from the hill <> | Subject | Re: PCI DMA to small buffers on cache-incoherent arch |
| |
Hi,
On 11 Jun 2002, Roland Dreier wrote: > 3) Change the code to > > struct something { > int field1; > char *dma_buffer; > int field2; > }; > > struct something *dev = kmalloc(sizeof *dev, GFP_KERNEL); > /* find pci_device */ > dev->dma_buffer = aligned_pci_alloc(pci_device, SMALLER_THAN_CACHELINE); > /* do DMA into dev->dma_buffer */
You introduce a possible null pointer dereference here, don't you?
// Assume this fails: struct something *dev = kmalloc(sizeof(struct something), GFP_KERNEL); // dev is a NULL pointer now. dev->dma_buffer = aligned_pci_alloc(pci_device, SMALLER_THAN_CACHELINE); // Big bang
Just wondering...
Regards, Thunder -- German attitude becoming | Thunder from the hill at ngforever rightaway popular: | "Get outa my way, | free inhabitant not directly for I got a mobile phone!" | belonging anywhere
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |