summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2011-11-09 18:45:38 +0000
committerAnthony Liguori <aliguori@us.ibm.com>2011-11-11 12:49:52 -0600
commit096685fc2a955ea17d5363ab452e301be2b43873 (patch)
treecb51c3ef29a58cb24e6c4e4e362908ed310b7741
parent1bbd1592c89a433e1a0501d582652d54d367ca53 (diff)
downloadhqemu-096685fc2a955ea17d5363ab452e301be2b43873.zip
hqemu-096685fc2a955ea17d5363ab452e301be2b43873.tar.gz
hw/omap_intc.c: Avoid crash on access to nonexistent banked registers
Avoid a crash due to null pointer dereference if a guest attempts to access banked registers for a nonexistent bank. Spotted by Coverity (see bug 887883). Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
-rw-r--r--hw/omap_intc.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/hw/omap_intc.c b/hw/omap_intc.c
index 0f7fd9d..45efa25 100644
--- a/hw/omap_intc.c
+++ b/hw/omap_intc.c
@@ -398,6 +398,9 @@ static uint64_t omap2_inth_read(void *opaque, target_phys_addr_t addr,
if (bank_no < s->nbanks) {
offset &= ~0x60;
bank = &s->bank[bank_no];
+ } else {
+ OMAP_BAD_REG(addr);
+ return 0;
}
}
@@ -476,6 +479,9 @@ static void omap2_inth_write(void *opaque, target_phys_addr_t addr,
if (bank_no < s->nbanks) {
offset &= ~0x60;
bank = &s->bank[bank_no];
+ } else {
+ OMAP_BAD_REG(addr);
+ return;
}
}
OpenPOWER on IntegriCloud