|
@@ -107,7 +107,12 @@ armpmu_map_cache_event(const unsigned (*cache_map)
|
|
static int
|
|
static int
|
|
armpmu_map_event(const unsigned (*event_map)[PERF_COUNT_HW_MAX], u64 config)
|
|
armpmu_map_event(const unsigned (*event_map)[PERF_COUNT_HW_MAX], u64 config)
|
|
{
|
|
{
|
|
- int mapping = (*event_map)[config];
|
|
|
|
|
|
+ int mapping;
|
|
|
|
+
|
|
|
|
+ if (config >= PERF_COUNT_HW_MAX)
|
|
|
|
+ return -EINVAL;
|
|
|
|
+
|
|
|
|
+ mapping = (*event_map)[config];
|
|
return mapping == HW_OP_UNSUPPORTED ? -ENOENT : mapping;
|
|
return mapping == HW_OP_UNSUPPORTED ? -ENOENT : mapping;
|
|
}
|
|
}
|
|
|
|
|