Thread (7 messages) flat view 7 messages, 3 authors, 2017-06-13

[PATCH] arm64/dma-mapping: Fix null-pointer check

From: linux@armlinux.org.uk (Russell King - ARM Linux)
Date: 2017-06-10 22:04:04
Also in: lkml

On Sat, Jun 10, 2017 at 12:41:10PM -0700, Olav Haugan wrote:
quoted hunk ↗ jump to hunk
@@ -149,6 +140,11 @@ static void *__dma_alloc(struct device *dev, size_t size,
 	bool coherent = is_device_dma_coherent(dev);
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

This re-introduces an instance that you say you're getting rid of...
 	pgprot_t prot = __get_dma_pgprot(attrs, PAGE_KERNEL, false);
 
+	if (!dev) {
+		WARN_ONCE(1, "Use an actual device structure for DMA allocation\n");
+		return NULL;
+	}
+
 	size = PAGE_ALIGN(size);
 
 	if (!coherent && !gfpflags_allow_blocking(flags)) {
-- 
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help