summary refs log tree commit diff stats
path: root/hw/gpio/imx_gpio.c
diff options
context:
space:
mode:
authorGabriel L. Somlo <somlo@cmu.edu>2015-11-05 09:32:50 -0500
committerGerd Hoffmann <kraxel@redhat.com>2015-12-15 11:45:59 +0100
commit66f8fd9dda312191b78d2a2ba2848bcee76127a2 (patch)
tree310b9fc80abbb6b2c41070637f20886ff10d043a /hw/gpio/imx_gpio.c
parent3f8752b4e5a3871f0d2963ab889be937d9a4226a (diff)
downloadfocaccia-qemu-66f8fd9dda312191b78d2a2ba2848bcee76127a2.tar.gz
focaccia-qemu-66f8fd9dda312191b78d2a2ba2848bcee76127a2.zip
fw_cfg: avoid calculating invalid current entry pointer
When calculating a pointer to the currently selected fw_cfg item, the
following is used:

  FWCfgEntry *e = &s->entries[arch][s->cur_entry & FW_CFG_ENTRY_MASK];

When s->cur_entry is FW_CFG_INVALID, we are calculating the address of
a non-existent element in s->entries[arch][...], which is undefined.

This patch ensures the resulting entry pointer is set to NULL whenever
s->cur_entry is FW_CFG_INVALID.

Reported-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Gabriel Somlo <somlo@cmu.edu>
Message-id: 1446733972-1602-5-git-send-email-somlo@cmu.edu
Cc: Marc MarĂ­ <markmb@redhat.com>
Signed-off-by: Gabriel Somlo <somlo@cmu.edu>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'hw/gpio/imx_gpio.c')
0 files changed, 0 insertions, 0 deletions