lkml.org 
[lkml]   [2006]   [Apr]   [1]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
DateSat, 1 Apr 2006 21:10:11 +0800
FromWu Fengguang <>
Subject[PATCH] i386 zone_sizes_init() fix
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@mail.ustc.edu.cn>
---
--- 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@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2006-04-01 13:14    [W:0.350 / U:0.090 seconds]
©2003-2008 Jasper Spaans