From: Julia Lawall Date: Mon, 23 Aug 2010 13:31:34 +0000 (+0100) Subject: arch/mn10300/mm: eliminate NULL dereference X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=6e0c64f4ddf4a76a04108c1e24132d5d7dea8872;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git arch/mn10300/mm: eliminate NULL dereference dev_name always dereferences its argument, so it should not be called if the argument is NULL. The function indeed later tests the argument for being NULL. The semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @@ expression dev,E; @@ *dev_name(dev) ... when != dev = E ( *dev == NULL | *dev != NULL ) // Signed-off-by: Julia Lawall Signed-off-by: David Howells Signed-off-by: Linus Torvalds --- diff --git a/arch/mn10300/mm/dma-alloc.c b/arch/mn10300/mm/dma-alloc.c index 4e34880bea03..159acb02cfd4 100644 --- a/arch/mn10300/mm/dma-alloc.c +++ b/arch/mn10300/mm/dma-alloc.c @@ -25,7 +25,8 @@ void *dma_alloc_coherent(struct device *dev, size_t size, unsigned long addr; void *ret; - printk("dma_alloc_coherent(%s,%zu,,%x)\n", dev_name(dev), size, gfp); + pr_debug("dma_alloc_coherent(%s,%zu,%x)\n", + dev ? dev_name(dev) : "?", size, gfp); if (0xbe000000 - pci_sram_allocated >= size) { size = (size + 255) & ~255;