aboutsummaryrefslogtreecommitdiff
path: root/core/test
diff options
context:
space:
mode:
authorStewart Smith <stewart@linux.vnet.ibm.com>2015-11-16 16:00:38 +1100
committerStewart Smith <stewart@linux.vnet.ibm.com>2015-11-16 16:00:42 +1100
commit4834fced49c6c8ccbc7237588df5cfe7c4e7cdd7 (patch)
tree03216afce43769f03b4ab8e4add4cb361c7e240f /core/test
parenta652c33f21e49314f495796a1efbc3f6dc6329c1 (diff)
downloadskiboot-4834fced49c6c8ccbc7237588df5cfe7c4e7cdd7.zip
skiboot-4834fced49c6c8ccbc7237588df5cfe7c4e7cdd7.tar.gz
skiboot-4834fced49c6c8ccbc7237588df5cfe7c4e7cdd7.tar.bz2
assert cpu < CPUS in core/test/run-trace.c
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'core/test')
-rw-r--r--core/test/run-trace.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/core/test/run-trace.c b/core/test/run-trace.c
index fc08512..fa8a30b 100644
--- a/core/test/run-trace.c
+++ b/core/test/run-trace.c
@@ -165,6 +165,7 @@ static bool all_done(const bool done[])
static void test_parallel(void)
{
void *p;
+ unsigned int cpu;
unsigned int i, counts[CPUS] = { 0 }, overflows[CPUS] = { 0 };
unsigned int repeats[CPUS] = { 0 }, num_overflows[CPUS] = { 0 };
bool done[CPUS] = { false };
@@ -224,9 +225,13 @@ static void test_parallel(void)
assert(be16_to_cpu(t.repeat.num) <= be16_to_cpu(t.hdr.cpu));
repeats[be16_to_cpu(t.hdr.cpu)] += be16_to_cpu(t.repeat.num);
} else if (t.hdr.type == 0x70) {
- done[be16_to_cpu(t.hdr.cpu)] = true;
+ cpu = be16_to_cpu(t.hdr.cpu);
+ assert(cpu < CPUS);
+ done[cpu] = true;
} else {
- counts[be16_to_cpu(t.hdr.cpu)]++;
+ cpu = be16_to_cpu(t.hdr.cpu);
+ assert(cpu < CPUS);
+ counts[cpu]++;
}
}