]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
arm64: early_alloc: Fix check for allocation failure
authorSuzuki K. Poulose <suzuki.poulose@arm.com>
Fri, 20 Nov 2015 17:45:40 +0000 (17:45 +0000)
committerCatalin Marinas <catalin.marinas@arm.com>
Wed, 25 Nov 2015 12:14:25 +0000 (12:14 +0000)
In early_alloc we check if the memblock_alloc failed by checking
the virtual address of the result, which will never fail. This patch
fixes it to check the actual result for failure.

Acked-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Suzuki K. Poulose <suzuki.poulose@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
arch/arm64/mm/mmu.c

index abb66f84d4ac896c0978b3c2584470d5db15a8ba..78d91b1eab84876ae06f53c4c8edae625921fcee 100644 (file)
@@ -64,8 +64,12 @@ EXPORT_SYMBOL(phys_mem_access_prot);
 
 static void __init *early_alloc(unsigned long sz)
 {
-       void *ptr = __va(memblock_alloc(sz, sz));
-       BUG_ON(!ptr);
+       phys_addr_t phys;
+       void *ptr;
+
+       phys = memblock_alloc(sz, sz);
+       BUG_ON(!phys);
+       ptr = __va(phys);
        memset(ptr, 0, sz);
        return ptr;
 }