In the case that bad_ioapic_register() fails, the current position of idx++
means that clear_fixmap(idx) will be called with the wrong index, and not
clean up the mapping just created.
Increment idx as part of the loop, rather than midway through the loop body.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
nr_irqs_gsi = 0;
- for ( i = 0; i < nr_ioapics; i++ )
+ for ( i = 0; i < nr_ioapics; i++, idx++ )
{
union IO_APIC_reg_01 reg_01;
paddr_t ioapic_phys = mp_ioapics[i].mpc_apicaddr;
set_fixmap_nocache(idx, ioapic_phys);
apic_printk(APIC_VERBOSE, "mapped IOAPIC to %08Lx (%08lx)\n",
__fix_to_virt(idx), ioapic_phys);
- idx++;
if ( bad_ioapic_register(i) )
{