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>
This commit is contained in:
parent
7482b0e962
commit
b4df32f4ae
@ -1202,6 +1202,7 @@ void __init e820_reserve_resources(void)
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
struct resource *res;
|
struct resource *res;
|
||||||
|
u64 end;
|
||||||
|
|
||||||
res = alloc_bootmem_low(sizeof(struct resource) * e820.nr_map);
|
res = alloc_bootmem_low(sizeof(struct resource) * e820.nr_map);
|
||||||
for (i = 0; i < e820.nr_map; i++) {
|
for (i = 0; i < e820.nr_map; i++) {
|
||||||
@ -1211,14 +1212,16 @@ void __init e820_reserve_resources(void)
|
|||||||
case E820_NVS: res->name = "ACPI Non-volatile Storage"; break;
|
case E820_NVS: res->name = "ACPI Non-volatile Storage"; break;
|
||||||
default: res->name = "reserved";
|
default: res->name = "reserved";
|
||||||
}
|
}
|
||||||
res->start = e820.map[i].addr;
|
end = e820.map[i].addr + e820.map[i].size - 1;
|
||||||
res->end = res->start + e820.map[i].size - 1;
|
|
||||||
#ifndef CONFIG_RESOURCES_64BIT
|
#ifndef CONFIG_RESOURCES_64BIT
|
||||||
if (res->end > 0x100000000ULL) {
|
if (end > 0x100000000ULL) {
|
||||||
res++;
|
res++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
res->start = e820.map[i].addr;
|
||||||
|
res->end = end;
|
||||||
|
|
||||||
res->flags = IORESOURCE_MEM | IORESOURCE_BUSY;
|
res->flags = IORESOURCE_MEM | IORESOURCE_BUSY;
|
||||||
insert_resource(&iomem_resource, res);
|
insert_resource(&iomem_resource, res);
|
||||||
res++;
|
res++;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user