mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] i386 zone_sizes_init() fix
@ 2006-04-01 13:10 Wu Fengguang
  2006-04-01 15:04 ` Andreas Schwab
  0 siblings, 1 reply; 3+ messages in thread
From: Wu Fengguang @ 2006-04-01 13:10 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel

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;

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-04-02  0:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-04-01 13:10 [PATCH] i386 zone_sizes_init() fix Wu Fengguang
2006-04-01 15:04 ` Andreas Schwab
2006-04-02  0:58   ` Wu Fengguang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome