public inbox for linux-arm-kernel@lists.infradead.org 
 help / color / mirror / Atom feed
* [PATCH] arm64: early_alloc: Fix check for allocation failure
@ 2015-11-20 17:45 Suzuki K. Poulose
  2015-11-23 15:24 ` Will Deacon
  2015-11-25 12:14 ` Catalin Marinas
  0 siblings, 2 replies; 3+ messages in thread
From: Suzuki K. Poulose @ 2015-11-20 17:45 UTC (permalink / raw)
  To: linux-arm-kernel

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.

Cc: Catalin Marinas <catalin.marinas@arm•com>
Cc: Will Deacon <will.deacon@arm•com>
Signed-off-by: Suzuki K. Poulose <suzuki.poulose@arm•com>
---
 arch/arm64/mm/mmu.c |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c
index e3f563c..e94c32b 100644
--- a/arch/arm64/mm/mmu.c
+++ b/arch/arm64/mm/mmu.c
@@ -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;
 }
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-11-25 12:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-20 17:45 [PATCH] arm64: early_alloc: Fix check for allocation failure Suzuki K. Poulose
2015-11-23 15:24 ` Will Deacon
2015-11-25 12:14 ` Catalin Marinas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox