mirror of
https://github.com/xemu-project/xemu.git
synced 2025-02-14 17:07:24 +00:00
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>
This commit is contained in:
parent
1bbd1592c8
commit
096685fc2a
@ -398,6 +398,9 @@ static uint64_t omap2_inth_read(void *opaque, target_phys_addr_t addr,
|
|||||||
if (bank_no < s->nbanks) {
|
if (bank_no < s->nbanks) {
|
||||||
offset &= ~0x60;
|
offset &= ~0x60;
|
||||||
bank = &s->bank[bank_no];
|
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) {
|
if (bank_no < s->nbanks) {
|
||||||
offset &= ~0x60;
|
offset &= ~0x60;
|
||||||
bank = &s->bank[bank_no];
|
bank = &s->bank[bank_no];
|
||||||
|
} else {
|
||||||
|
OMAP_BAD_REG(addr);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user