Files
qemu/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
..
2021-10-12 08:20:08 +02:00
2021-02-21 18:41:04 +01:00
2021-09-20 08:50:59 +02:00
2021-03-05 15:17:34 +00:00
2021-09-29 10:45:19 +02:00
2021-09-30 12:26:06 +10:00
2020-09-09 09:27:09 -04:00
2020-09-09 09:27:09 -04:00
2021-03-06 16:18:42 +01:00
2020-09-09 09:27:09 -04:00
2021-09-21 07:56:49 +10:00
2021-05-12 17:42:23 +02:00
2020-09-09 09:27:09 -04:00
2020-09-09 09:27:09 -04:00
2020-09-09 09:27:09 -04:00
2020-09-18 14:12:32 -04:00
2020-09-09 09:27:09 -04:00
2020-09-09 09:27:09 -04:00