[PATCH 2/2] kexec: add additional check when getting memory info

Zhang Yanfei zhangyanfei at cn.fujitsu.com
Fri Jan 11 03:58:45 EST 2013


This check makes sure that we indeed get the memory information.

Signed-off-by: Zhang Yanfei <zhangyanfei at cn.fujitsu.com>
---
 kexec/kexec.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/kexec/kexec.c b/kexec/kexec.c
index 89ec182..16c6308 100644
--- a/kexec/kexec.c
+++ b/kexec/kexec.c
@@ -675,7 +675,7 @@ static int my_load(const char *type, int fileind, int argc, char **argv,
 #endif
 
 	if (get_memory_ranges(&info.memory_range, &info.memory_ranges,
-		info.kexec_flags) < 0) {
+		info.kexec_flags) < 0 || info.memory_ranges == 0) {
 		fprintf(stderr, "Could not get memory layout\n");
 		return -1;
 	}
-- 
1.7.1



More information about the kexec mailing list