[PATCH] i386 zone_sizes_init() fix

From: Wu Fengguang
Date: Sat Apr 01 2006 - 08:11:43 EST


Now that with MAX_NR_ZONES=4, the last element of zones_size[] is
left uninitialized in zone_sizes_init() on i386.

Fix this by using gcc's range initializer to protect from future changes.

Signed-off-by: Wu Fengguang <wfg@xxxxxxxxxxxxxxxx>
---

--- linux-2.6.16-mm2.orig/arch/i386/mm/discontig.c
+++ linux-2.6.16-mm2/arch/i386/mm/discontig.c
@@ -355,7 +355,7 @@ void __init zone_sizes_init(void)


for_each_online_node(nid) {
- unsigned long zones_size[MAX_NR_ZONES] = {0, 0, 0};
+ unsigned long zones_size[] = { [0 ... MAX_NR_ZONES-1] = 0 };
unsigned long *zholes_size;
unsigned int max_dma;

--- linux-2.6.16-mm2.orig/arch/i386/kernel/setup.c
+++ linux-2.6.16-mm2/arch/i386/kernel/setup.c
@@ -1203,7 +1203,7 @@ static unsigned long __init setup_memory

void __init zone_sizes_init(void)
{
- unsigned long zones_size[MAX_NR_ZONES] = {0, 0, 0};
+ unsigned long zones_size[] = { [0 ... MAX_NR_ZONES-1] = 0 };
unsigned int max_dma, low;

max_dma = virt_to_phys((char *)MAX_DMA_ADDRESS) >> PAGE_SHIFT;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/