Skip to contentSkip to conversation

+ mm-nobootmemc-add-return-value-check-in-__alloc_memory_core_early.patch added to -mm tree

PATCH [email protected] 1 participant 1 message Jan 7, 2014 Memory management

lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

Subject: + mm-nobootmemc-add-return-value-check-in-__alloc_memory_core_early.patch added to -mm tree
To: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected]
From: [email protected]
Date: Tue, 07 Jan 2014 13:40:06 -0800

The patch titled
Subject: mm/nobootmem.c: add return value check in __alloc_memory_core_early()
has been added to the -mm tree. Its filename is
mm-nobootmemc-add-return-value-check-in-__alloc_memory_core_early.patch

This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/mm-nobootmemc-add-return-value-check-in-__alloc_memory_core_early.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/mm-nobootmemc-add-return-value-check-in-__alloc_memory_core_early.patch

Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/SubmitChecklist when testing your code ***

The -mm tree is included into linux-next and is updated there every 3-4 working days

------------------------------------------------------
From: Philipp Hachtmann <[email protected]>
Subject: mm/nobootmem.c: add return value check in __alloc_memory_core_early()

When memblock_reserve() fails because memblock.reserved.regions cannot be resized, the caller (e.g. alloc_bootmem()) is not informed of the failed allocation. Therefore alloc_bootmem() silently returns the same pointer again and again.

This patch adds a check for the return value of memblock_reserve() in __alloc_memory_core().

---

 mm/nobootmem.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
mm/nobootmem.c renamed from mm/nobootmem.c~mm-nobootmemc-add-return-value-check-in-__alloc_memory_core_early +3 -1
diff -puN mm/nobootmem.c~mm-nobootmemc-add-return-value-check-in-__alloc_memory_core_early mm/nobootmem.c
@@ -45,7 +45,9 @@ static void * __init __alloc_memory_core
 	if (!addr)
 		return NULL;
 
-	memblock_reserve(addr, size);
+	if (memblock_reserve(addr, size))
+		return NULL;
+
 	ptr = phys_to_virt(addr);
 	memset(ptr, 0, size);
 	/*

_

Patches currently in -mm which might be from [email protected] are

mm-nobootmemc-add-return-value-check-in-__alloc_memory_core_early.patch