summaryrefslogtreecommitdiff
path: root/drivers/perf/arm-cmn.c
diff options
context:
space:
mode:
authorRobin Murphy <robin.murphy@arm.com>2022-05-11 00:23:08 +0300
committerWill Deacon <will@kernel.org>2022-05-11 12:20:42 +0300
commit3630b2a86390b4be907d8685b2fddee0dd73a835 (patch)
tree4591b215d228ad4ed7ea87275ba5827c608f2128 /drivers/perf/arm-cmn.c
parent33835e8dfb3c79821cdc6e2a9b48ae05bd4820dc (diff)
downloadlinux-3630b2a86390b4be907d8685b2fddee0dd73a835.tar.xz
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 <quic_qiancai@quicinc.com> Signed-off-by: Robin Murphy <robin.murphy@arm.com> Link: https://lore.kernel.org/r/bebba768156aa3c0757140457bdd0fec10819388.1652217788.git.robin.murphy@arm.com Signed-off-by: Will Deacon <will@kernel.org>
Diffstat (limited to 'drivers/perf/arm-cmn.c')
-rw-r--r--drivers/perf/arm-cmn.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/perf/arm-cmn.c b/drivers/perf/arm-cmn.c
index 62f3842d1a47..a8421a43740c 100644
--- a/drivers/perf/arm-cmn.c
+++ b/drivers/perf/arm-cmn.c
@@ -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;