Skip to content

Commit 3630b2a

Browse files
rmurphy-armwilldeacon
authored andcommitted
perf/arm-cmn: Fix filter_sel lookup
Carefully considering the bounds of an array is all well and good, until you forget that that array also contains a NULL sentinel at the end and dereference it. So close... Reported-by: Qian Cai <[email protected]> Signed-off-by: Robin Murphy <[email protected]> Link: https://lore.kernel.org/r/bebba768156aa3c0757140457bdd0fec10819388.1652217788.git.robin.murphy@arm.com Signed-off-by: Will Deacon <[email protected]>
1 parent 33835e8 commit 3630b2a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/perf/arm-cmn.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1514,7 +1514,7 @@ static enum cmn_filter_select arm_cmn_filter_sel(enum cmn_model model,
15141514
struct arm_cmn_event_attr *e;
15151515
int i;
15161516

1517-
for (i = 0; i < ARRAY_SIZE(arm_cmn_event_attrs); i++) {
1517+
for (i = 0; i < ARRAY_SIZE(arm_cmn_event_attrs) - 1; i++) {
15181518
e = container_of(arm_cmn_event_attrs[i], typeof(*e), attr.attr);
15191519
if (e->model & model && e->type == type && e->eventid == eventid)
15201520
return e->fsel;

0 commit comments

Comments
 (0)