aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabien Chouteau <chouteau@adacore.com>2015-02-25 10:50:28 +0100
committerAlexander Graf <agraf@suse.de>2015-03-09 15:00:03 +0100
commit04d2acbb57900f1cba2eef86b21ab78d854683db (patch)
tree8d2312fee4908568df08e2b39821c3324e5d8e94
parenteefaccc02bab659c8cb4c994b2f385c3f0a27551 (diff)
Openpic: check that cpu id is within the number of cpus
Signed-off-by: Fabien Chouteau <chouteau@adacore.com> Signed-off-by: Alexander Graf <agraf@suse.de>
-rw-r--r--hw/intc/openpic.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/hw/intc/openpic.c b/hw/intc/openpic.c
index 7d1f3b9497..305377d899 100644
--- a/hw/intc/openpic.c
+++ b/hw/intc/openpic.c
@@ -1013,7 +1013,7 @@ static void openpic_cpu_write_internal(void *opaque, hwaddr addr,
DPRINTF("%s: cpu %d addr %#" HWADDR_PRIx " <= 0x%08x\n", __func__, idx,
addr, val);
- if (idx < 0) {
+ if (idx < 0 || idx >= opp->nb_cpus) {
return;
}
@@ -1152,7 +1152,7 @@ static uint32_t openpic_cpu_read_internal(void *opaque, hwaddr addr,
DPRINTF("%s: cpu %d addr %#" HWADDR_PRIx "\n", __func__, idx, addr);
retval = 0xFFFFFFFF;
- if (idx < 0) {
+ if (idx < 0 || idx >= opp->nb_cpus) {
return retval;
}