File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -304,17 +304,20 @@ set_ext_hw_attr(struct hw_perf_event *hwc, struct perf_event *event)
304
304
305
305
config = attr -> config ;
306
306
307
- cache_type = (config >> 0 ) & 0xff ;
307
+ cache_type = (config >> 0 ) & 0xff ;
308
308
if (cache_type >= PERF_COUNT_HW_CACHE_MAX )
309
309
return - EINVAL ;
310
+ cache_type = array_index_nospec (cache_type , PERF_COUNT_HW_CACHE_MAX );
310
311
311
312
cache_op = (config >> 8 ) & 0xff ;
312
313
if (cache_op >= PERF_COUNT_HW_CACHE_OP_MAX )
313
314
return - EINVAL ;
315
+ cache_op = array_index_nospec (cache_op , PERF_COUNT_HW_CACHE_OP_MAX );
314
316
315
317
cache_result = (config >> 16 ) & 0xff ;
316
318
if (cache_result >= PERF_COUNT_HW_CACHE_RESULT_MAX )
317
319
return - EINVAL ;
320
+ cache_result = array_index_nospec (cache_result , PERF_COUNT_HW_CACHE_RESULT_MAX );
318
321
319
322
val = hw_cache_event_ids [cache_type ][cache_op ][cache_result ];
320
323
You can’t perform that action at this time.
0 commit comments