Skip to contentSkip to conversation

xen/arch/x86/x86_32/mm.c

PATCH In review Jerone Young 2 participants 2 messages Aug 11, 2005

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xen/arch/x86/x86_32/mm.c

Well this is a bug. Iterator i is being used in both top & embeded for loops.

--- xen/arch/x86/x86_32/mm.c.old 2005-08-11 13:53:44.000000000
-0500
+++ xen/arch/x86/x86_32/mm.c 2005-08-11 13:55:20.000000000 -0500
@@ -67,7 +67,7 @@ void __init paging_init(void)

     void *ioremap_pt;
     unsigned long v;
     struct pfn_info *pg;

- int i, mapcache_order;
+ int i,n,mapcache_order;

#ifdef CONFIG_X86_PAE
     printk("PAE enabled, limit: %d GB\n", MACHPHYS_MBYTES);
@@ -170,10 +170,10 @@ void subarch_init_memory(struct domain *
     }

     /* M2P table is mappable read-only by privileged domains. */
-    for ( i = 0; i < (mpt_size >> L2_PAGETABLE_SHIFT); i++ )
+    for ( n = 0; n < (mpt_size >> L2_PAGETABLE_SHIFT); n++ )
     {
         m2p_start_mfn = l2e_get_pfn(
-            idle_pg_table_l2[l2_linear_offset(RDWR_MPT_VIRT_START) +
i]);
+            idle_pg_table_l2[l2_linear_offset(RDWR_MPT_VIRT_START) +
n]);
         for ( i = 0; i < L2_PAGETABLE_ENTRIES; i++ )
         {
             frame_table[m2p_start_mfn+i].count_info = PGC_allocated |

1;

Signature · 4 lines
Jerone Young
IBM Linux Technology Center
[email protected]
512-838-1157 (T/L: 678-1157)
#1 lore raw
Quoted 4 lines · Jerone Young

Well this is a bug. Iterator i is being used in both top & embeded for loops.

You didn't even compile test this one -- you defined the new loop variable in the wrong function!

-- Keir