From: BALATON Zoltan Date: Sat, 16 May 2020 13:13:03 +0000 (+0200) Subject: ati-vga: Do not allow unaligned access via index register X-Git-Tag: pull-nvme-20200902~257^2~7 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=b0588cb51da6986715294bfec4b52f55612a666e;p=qemu-nvme.git ati-vga: Do not allow unaligned access via index register According to docs bits 1 and 0 of MM_INDEX are hard coded to 0 so unaligned access via this register should not be possible. This also fixes problems reported in bug #1878134. Buglink: https://bugs.launchpad.net/qemu/+bug/1878134 Signed-off-by: BALATON Zoltan Tested-by: Alexander Bulekov Acked-by: Alexander Bulekov Message-id: 20200516132352.39E9374594E@zero.eik.bme.hu Signed-off-by: Gerd Hoffmann --- diff --git a/hw/display/ati.c b/hw/display/ati.c index 58ec8291d4..065f197678 100644 --- a/hw/display/ati.c +++ b/hw/display/ati.c @@ -511,7 +511,7 @@ static void ati_mm_write(void *opaque, hwaddr addr, } switch (addr) { case MM_INDEX: - s->regs.mm_index = data; + s->regs.mm_index = data & ~3; break; case MM_DATA ... MM_DATA + 3: /* indexed access to regs or memory */