Skip to content

Commit

Permalink
Openpic: check that cpu id is within the number of cpus
Browse files Browse the repository at this point in the history
Signed-off-by: Fabien Chouteau <chouteau@adacore.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
  • Loading branch information
Fabien-Chouteau authored and agraf committed Mar 9, 2015
1 parent eefaccc commit 04d2acb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions hw/intc/openpic.c
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit 04d2acb

Please sign in to comment.