qemu-e2k/include/hw
Peter Delevoryas 87bd33e8b0 hw: aspeed_gpio: Fix GPIO array indexing
The gpio array is declared as a dense array:

  qemu_irq gpios[ASPEED_GPIO_NR_PINS];

(AST2500 has 228, AST2400 has 216, AST2600 has 208)

However, this array is used like a matrix of GPIO sets
(e.g. gpio[NR_SETS][NR_PINS_PER_SET] = gpio[8][32])

  size_t offset = set * GPIOS_PER_SET + gpio;
  qemu_set_irq(s->gpios[offset], !!(new & mask));

This can result in an out-of-bounds access to "s->gpios" because the
gpio sets do _not_ have the same length. Some of the groups (e.g.
GPIOAB) only have 4 pins. 228 != 8 * 32 == 256.

To fix this, I converted the gpio array from dense to sparse, to that
match both the hardware layout and this existing indexing code.

Fixes: 4b7f956862 ("hw/gpio: Add basic Aspeed GPIO model for AST2400 and AST2500")
Signed-off-by: Peter Delevoryas <pdel@fb.com>
Message-Id: <20211008033501.934729-2-pdel@fb.com>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
2021-10-12 08:20:08 +02:00
..
acpi hw/i386/acpi: fix conflicting IO address range for acpi pci hotplug in q35 2021-10-05 17:30:57 -04:00
adc
arm hw/arm: xlnx-zcu102: Add Xilinx eFUSE device 2021-09-30 13:42:10 +01:00
audio
block
char hw/char/mchp_pfsoc_mmuart: QOM'ify PolarFire MMUART 2021-10-07 08:41:33 +10:00
core hw/core/cpu: Re-sort the non-pointers to the end of CPUClass 2021-10-05 16:53:17 -07:00
cpu
cris
display macfb: add vertical blank interrupt 2021-10-08 13:31:03 +02:00
dma hw/dma/xlnx-zdma Always expect 'dma' link property to be set 2021-08-26 17:01:59 +01:00
firmware
gpio hw: aspeed_gpio: Fix GPIO array indexing 2021-10-12 08:20:08 +02:00
hyperv
i2c aspeed/i2c: QOMify AspeedI2CBus 2021-10-12 08:20:08 +02:00
i386 acpi: x86: set enabled when composing _MAT entries 2021-10-05 17:30:57 -04:00
ide ide: Rename ide_bus_new() to ide_bus_init() 2021-09-30 13:44:13 +01:00
input
intc hw/intc: Upgrade the SiFive CLINT implementation to RISC-V ACLINT 2021-09-21 07:56:49 +10:00
ipack ipack: Rename ipack_bus_new_inplace() to ipack_bus_init() 2021-09-30 13:42:10 +01:00
ipmi
isa hw/ide: Fix crash when plugging a piix3-ide device into the x-remote machine 2021-07-19 10:08:45 +02:00
kvm
m68k
mem
mips
misc aspeed: Emulate the AST2600A3 2021-09-20 08:50:59 +02:00
net
nubus nubus: add support for slot IRQs 2021-09-29 10:45:19 +02:00
nvram hw/nvram: Introduce Xilinx battery-backed ram 2021-09-30 13:42:10 +01:00
pci pci: Rename pci_root_bus_new_inplace() to pci_root_bus_init() 2021-09-30 13:42:10 +01:00
pci-bridge
pci-host hw/pci: remove all references to find_i440fx function 2021-09-04 17:34:05 -04:00
ppc hw/intc: openpic: Clean up the styles 2021-09-30 12:26:06 +10:00
rdma
remote
riscv hw/riscv: virt: Add optional ACLINT support to virt machine 2021-09-21 07:56:49 +10:00
rtc
rx
s390x s390x: Replace PAGE_SIZE, PAGE_SHIFT and PAGE_MASK 2021-09-06 16:25:27 +02:00
scsi scsi: Replace scsi_bus_new() with scsi_bus_init(), scsi_bus_init_named() 2021-09-30 13:42:10 +01:00
sd
sensor
sh4
southbridge
sparc
ssi aspeed/smc: Remove unused attribute 'irqline' 2021-10-12 08:20:08 +02:00
timer hw/timer: Add SiFive PWM support 2021-09-21 07:56:49 +10:00
tricore
usb
vfio vfio: Query and store the maximum number of possible DMA mappings 2021-07-08 15:54:45 -04:00
virtio vhost-vsock: handle common features in vhost-vsock-common 2021-10-05 17:30:57 -04:00
watchdog watchdog: aspeed: Sanitize control register values 2021-09-20 08:50:59 +02:00
xen
xtensa
boards.h machine: Move smp_prefer_sockets to struct SMPCompatProps 2021-10-01 15:29:15 +02:00
clock.h clock: Provide builtin multiplier/divider 2021-09-01 11:08:19 +01:00
elf_ops.h
fw-path-provider.h
hotplug.h
hw.h
ide.h
irq.h
loader-fit.h
loader.h hw/loader: Restrict PC_ROM_* definitions to hw/i386/pc 2021-09-27 10:57:21 +02:00
nmi.h
or-irq.h
pcmcia.h
platform-bus.h
ptimer.h
qdev-clock.h
qdev-core.h qbus: Rename qbus_create() to qbus_new() 2021-09-30 13:44:08 +01:00
qdev-dma.h
qdev-properties-system.h
qdev-properties.h qdev-properties: PropertyInfo: add realized_set_allowed field 2021-09-01 12:57:31 +02:00
register.h hw/core/register: Add more 64-bit utilities 2021-09-01 11:59:12 +10:00
registerfields.h hw/registerfields: Use 64-bit bitfield for FIELD_DP64 2021-09-01 11:59:12 +10:00
resettable.h
stream.h
sysbus.h
usb.h usb: drop usb_host_dev_is_scsi_storage hook 2021-07-09 18:21:33 +02:00
vmstate-if.h