* [PATCH] coresight: cti: fix the check condition in inout_sel_store
@ 2026-03-27 6:24 Jie Gan
2026-03-27 9:56 ` Leo Yan
2026-03-27 11:32 ` Suzuki K Poulose
0 siblings, 2 replies; 3+ messages in thread
From: Jie Gan @ 2026-03-27 6:24 UTC (permalink / raw)
To: Suzuki K Poulose, Mike Leach, James Clark, Leo Yan,
Alexander Shishkin, Mathieu Poirier, Greg Kroah-Hartman,
Tingwei Zhang
Cc: coresight, linux-arm-kernel, linux-kernel, Jie Gan
Correct the upper bound from CTIINOUTEN_MAX to config->nr_trig_max,
since nr_trig_max varies across CTI devices. An out-of-bounds issue
occurs when a value greater than config->nr_trig_max is provided,
leading to unexpected errors.
Fixes: b5213376c240 ("coresight: cti: Add sysfs access to program function registers")
Signed-off-by: Jie Gan <jie.gan@oss.qualcomm.com>
---
drivers/hwtracing/coresight/coresight-cti-sysfs.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/hwtracing/coresight/coresight-cti-sysfs.c b/drivers/hwtracing/coresight/coresight-cti-sysfs.c
index 4c0a60840efb..bf3c73607c1c 100644
--- a/drivers/hwtracing/coresight/coresight-cti-sysfs.c
+++ b/drivers/hwtracing/coresight/coresight-cti-sysfs.c
@@ -337,10 +337,11 @@ static ssize_t inout_sel_store(struct device *dev,
{
unsigned long val;
struct cti_drvdata *drvdata = dev_get_drvdata(dev->parent);
+ struct cti_config *config = &drvdata->config;
if (kstrtoul(buf, 0, &val))
return -EINVAL;
- if (val > (CTIINOUTEN_MAX - 1))
+ if (val >= config->nr_trig_max)
return -EINVAL;
guard(raw_spinlock_irqsave)(&drvdata->spinlock);
---
base-commit: e77a5a5cfe43b4c25bd44a3818e487033287517f
change-id: 20260327-fix-cti-issue-3dda5e4636f7
Best regards,
--
Jie Gan <jie.gan@oss.qualcomm.com>
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] coresight: cti: fix the check condition in inout_sel_store
2026-03-27 6:24 [PATCH] coresight: cti: fix the check condition in inout_sel_store Jie Gan
@ 2026-03-27 9:56 ` Leo Yan
2026-03-27 11:32 ` Suzuki K Poulose
1 sibling, 0 replies; 3+ messages in thread
From: Leo Yan @ 2026-03-27 9:56 UTC (permalink / raw)
To: Jie Gan
Cc: Suzuki K Poulose, Mike Leach, James Clark, Alexander Shishkin,
Mathieu Poirier, Greg Kroah-Hartman, Tingwei Zhang, coresight,
linux-arm-kernel, linux-kernel
On Fri, Mar 27, 2026 at 02:24:14PM +0800, Jie Gan wrote:
> Correct the upper bound from CTIINOUTEN_MAX to config->nr_trig_max,
> since nr_trig_max varies across CTI devices. An out-of-bounds issue
> occurs when a value greater than config->nr_trig_max is provided,
> leading to unexpected errors.
>
> Fixes: b5213376c240 ("coresight: cti: Add sysfs access to program function registers")
> Signed-off-by: Jie Gan <jie.gan@oss.qualcomm.com>
Reviewed-by: Leo Yan <leo.yan@arm.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] coresight: cti: fix the check condition in inout_sel_store
2026-03-27 6:24 [PATCH] coresight: cti: fix the check condition in inout_sel_store Jie Gan
2026-03-27 9:56 ` Leo Yan
@ 2026-03-27 11:32 ` Suzuki K Poulose
1 sibling, 0 replies; 3+ messages in thread
From: Suzuki K Poulose @ 2026-03-27 11:32 UTC (permalink / raw)
To: Mike Leach, James Clark, Leo Yan, Alexander Shishkin,
Mathieu Poirier, Greg Kroah-Hartman, Tingwei Zhang, Jie Gan
Cc: Suzuki K Poulose, coresight, linux-arm-kernel, linux-kernel
On Fri, 27 Mar 2026 14:24:14 +0800, Jie Gan wrote:
> Correct the upper bound from CTIINOUTEN_MAX to config->nr_trig_max,
> since nr_trig_max varies across CTI devices. An out-of-bounds issue
> occurs when a value greater than config->nr_trig_max is provided,
> leading to unexpected errors.
>
>
Applied, thanks!
[1/1] coresight: cti: fix the check condition in inout_sel_store
https://git.kernel.org/coresight/c/08643a8760e8
Best regards,
--
Suzuki K Poulose <suzuki.poulose@arm.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-03-27 11:32 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-27 6:24 [PATCH] coresight: cti: fix the check condition in inout_sel_store Jie Gan
2026-03-27 9:56 ` Leo Yan
2026-03-27 11:32 ` Suzuki K Poulose
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox