[PATCH] i386 zone_sizes_init() fix

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <[email protected]>
---

--- 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 [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux