VirtualBox

Changeset 37637 in vbox for trunk


Ignore:
Timestamp:
Jun 24, 2011 3:06:23 PM (13 years ago)
Author:
vboxsync
Message:

ioapicMMIOWrite: Don't access more than cb bytes from pv!

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/PC/DevIoApic.cpp

    r37636 r37637  
    399399
    400400    STAM_COUNTER_INC(&CTXSUFF(s->StatMMIOWrite));
    401     switch (cb) {
    402     case 1:
    403     case 2:
    404     case 4:
    405         IOAPIC_LOCK(s, VINF_IOM_HC_MMIO_WRITE);
    406         ioapic_mem_writel(s, GCPhysAddr, *(uint32_t *)pv); /** @todo r=bird: This cannot be right for cb!=4. */
    407         IOAPIC_UNLOCK(s);
    408         break;
    409 
    410     default:
    411         AssertReleaseMsgFailed(("cb=%d\n", cb)); /* for now we assume simple accesses. */
    412         return VERR_INTERNAL_ERROR;
    413     }
     401    IOAPIC_LOCK(s, VINF_IOM_HC_MMIO_WRITE);
     402    switch (cb)
     403    {
     404        case 1: ioapic_mem_writel(s, GCPhysAddr, *(uint8_t  const *)pv); break;
     405        case 2: ioapic_mem_writel(s, GCPhysAddr, *(uint16_t const *)pv); break;
     406        case 4: ioapic_mem_writel(s, GCPhysAddr, *(uint32_t const *)pv); break;
     407
     408        default:
     409            IOAPIC_UNLOCK(s);
     410            AssertReleaseMsgFailed(("cb=%d\n", cb)); /* for now we assume simple accesses. */
     411            return VERR_INTERNAL_ERROR;
     412    }
     413    IOAPIC_UNLOCK(s);
    414414    return VINF_SUCCESS;
    415415}
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette