]> Git Repo - linux.git/commitdiff
ARM: 8816/1: dma-mapping: fix potential uninitialized return
authorNathan Jones <[email protected]>
Tue, 4 Dec 2018 09:05:32 +0000 (10:05 +0100)
committerRussell King <[email protected]>
Tue, 4 Dec 2018 22:38:34 +0000 (22:38 +0000)
While trying to use the dma_mmap_*() interface, it was noticed that this
interface returns strange values when passed an incorrect length.

If neither of the if() statements fire then the return value is
uninitialized. In the worst case it returns 0 which means the caller
will think the function succeeded.

Fixes: 1655cf8829d8 ("ARM: dma-mapping: Remove traces of NOMMU code")
Signed-off-by: Nathan Jones <[email protected]>
Reviewed-by: Robin Murphy <[email protected]>
Acked-by: Vladimir Murzin <[email protected]>
Signed-off-by: Russell King <[email protected]>
arch/arm/mm/dma-mapping.c

index 661fe48ab78da175732920d87046ec7460bc5d8f..78de138aa66dc48ccdfc223dc75dd017961feb28 100644 (file)
@@ -829,7 +829,7 @@ static int __arm_dma_mmap(struct device *dev, struct vm_area_struct *vma,
                 void *cpu_addr, dma_addr_t dma_addr, size_t size,
                 unsigned long attrs)
 {
-       int ret;
+       int ret = -ENXIO;
        unsigned long nr_vma_pages = vma_pages(vma);
        unsigned long nr_pages = PAGE_ALIGN(size) >> PAGE_SHIFT;
        unsigned long pfn = dma_to_pfn(dev, dma_addr);
This page took 0.068519 seconds and 4 git commands to generate.