diff options
author | Yinghai Lu <yhlu.kernel@gmail.com> | 2008-06-28 20:49:59 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-07-08 07:16:07 -0400 |
commit | b4df32f4aeef8794d0135fc8dc250acb44cfee60 (patch) | |
tree | 357d504a9cf6f3beb544b3ad36671e3052d9c7ed /arch/x86/kernel/e820.c | |
parent | 7482b0e962e128c5b574aa29761f97164189ef14 (diff) |
x86: fix warning in e820_reserve_resources with 32bit
when 64bit resource is not enabled, we get:
arch/x86/kernel/e820.c: In function ‘e820_reserve_resources’:
arch/x86/kernel/e820.c:1217: warning: comparison is always false due to limited range of data type
because res->start/end is resource_t aka u32. it will overflow.
fix it with temp end of u64
Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/kernel/e820.c')
-rw-r--r-- | arch/x86/kernel/e820.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c index fa77cb4185c3..ba5ac880ea1e 100644 --- a/arch/x86/kernel/e820.c +++ b/arch/x86/kernel/e820.c | |||
@@ -1202,6 +1202,7 @@ void __init e820_reserve_resources(void) | |||
1202 | { | 1202 | { |
1203 | int i; | 1203 | int i; |
1204 | struct resource *res; | 1204 | struct resource *res; |
1205 | u64 end; | ||
1205 | 1206 | ||
1206 | res = alloc_bootmem_low(sizeof(struct resource) * e820.nr_map); | 1207 | res = alloc_bootmem_low(sizeof(struct resource) * e820.nr_map); |
1207 | for (i = 0; i < e820.nr_map; i++) { | 1208 | for (i = 0; i < e820.nr_map; i++) { |
@@ -1211,14 +1212,16 @@ void __init e820_reserve_resources(void) | |||
1211 | case E820_NVS: res->name = "ACPI Non-volatile Storage"; break; | 1212 | case E820_NVS: res->name = "ACPI Non-volatile Storage"; break; |
1212 | default: res->name = "reserved"; | 1213 | default: res->name = "reserved"; |
1213 | } | 1214 | } |
1214 | res->start = e820.map[i].addr; | 1215 | end = e820.map[i].addr + e820.map[i].size - 1; |
1215 | res->end = res->start + e820.map[i].size - 1; | ||
1216 | #ifndef CONFIG_RESOURCES_64BIT | 1216 | #ifndef CONFIG_RESOURCES_64BIT |
1217 | if (res->end > 0x100000000ULL) { | 1217 | if (end > 0x100000000ULL) { |
1218 | res++; | 1218 | res++; |
1219 | continue; | 1219 | continue; |
1220 | } | 1220 | } |
1221 | #endif | 1221 | #endif |
1222 | res->start = e820.map[i].addr; | ||
1223 | res->end = end; | ||
1224 | |||
1222 | res->flags = IORESOURCE_MEM | IORESOURCE_BUSY; | 1225 | res->flags = IORESOURCE_MEM | IORESOURCE_BUSY; |
1223 | insert_resource(&iomem_resource, res); | 1226 | insert_resource(&iomem_resource, res); |
1224 | res++; | 1227 | res++; |