[PATCH] memblock: Fix error path in memblock_add_region()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



@type->regions should be restored if memblock_double_array() fails.

Signed-off-by: Namhyung Kim <namhyung@xxxxxxxxx>
Cc: Benjamin Herrenschmidt <benh@xxxxxxxxxxxxxxxxxxx>
Cc: Yinghai Lu <yinghai@xxxxxxxxxx>
---
 mm/memblock.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/mm/memblock.c b/mm/memblock.c
index bdba245d8afd..49284f9f99a6 100644
--- a/mm/memblock.c
+++ b/mm/memblock.c
@@ -379,6 +379,10 @@ static long __init_memblock memblock_add_region(struct memblock_type *type, phys
 	 */
 	if (type->cnt == type->max && memblock_double_array(type)) {
 		type->cnt--;
+		for (++i; i < type->cnt; i++) {
+			type->regions[i].base = type->regions[i+1].base;
+			type->regions[i].size = type->regions[i+1].size;
+		}
 		return -1;
 	}
 
-- 
1.7.3.4.600.g982838b0

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxxx  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]