Commit 3630b2a8 authored by Robin Murphy's avatar Robin Murphy Committed by Will Deacon
Browse files

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: default avatarQian Cai <quic_qiancai@quicinc.com>
Signed-off-by: default avatarRobin Murphy <robin.murphy@arm.com>
Link: https://lore.kernel.org/r/bebba768156aa3c0757140457bdd0fec10819388.1652217788.git.robin.murphy@arm.com


Signed-off-by: default avatarWill Deacon <will@kernel.org>
parent 33835e8d
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1514,7 +1514,7 @@ static enum cmn_filter_select arm_cmn_filter_sel(enum cmn_model model,
	struct arm_cmn_event_attr *e;
	int i;

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