[RFC PATCH 1/4] Fix an overflow bug with address comparison

Matthew Leach matthew.leach at arm.com
Wed Sep 5 07:44:00 EDT 2012


The variables mstart and mend are assigned the values of
mem_region[i].start and mem_region[i].end which are of the type
unsigned long long. Ensure that mstart and mend are of the same data
type to prevent address overflow.

Signed-off-by: Matthew Leach <matthew.leach at arm.com>
---
 kexec/kexec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kexec/kexec.c b/kexec/kexec.c
index 8928be0..c7b38e3 100644
--- a/kexec/kexec.c
+++ b/kexec/kexec.c
@@ -108,7 +108,7 @@ int valid_memory_range(struct kexec_info *info,
 		return 0;
 	}
 	for (i = 0; i < info->memory_ranges; i++) {
-		unsigned long mstart, mend;
+		unsigned long long mstart, mend;
 		/* Only consider memory ranges */
 		if (info->memory_range[i].type != RANGE_RAM)
 			continue;
-- 
1.7.12




More information about the kexec mailing list