[PATCH] coresight: etm3x: Fix buffer overwrite in cntr_val_show()
Leo Yan
leo.yan at arm.com
Thu Nov 27 01:57:02 PST 2025
On Thu, Nov 27, 2025 at 09:30:28AM +0000, James Clark wrote:
[...]
> > > - for (i = 0; i < drvdata->nr_cntr; i++) {
> > > - val = etm_readl(drvdata, ETMCNTVRn(i));
> > > - ret += sprintf(buf, "counter %d: %x\n", i, val);
> > > + return sprintf(buf, "%x\n", val);
> > > }
> > > - return ret;
> > > + val = etm_readl(drvdata, ETMCNTVRn(config->cntr_idx));
> >
> > It is not right to read register at here (it cannot promise to read the
> > CPU (cp14) register on the target CPU).
> >
> > Please refer to the same function in coresight-etm4x-sysfs.c. I think
> > we can do the same thing at here.
> >
>
> That's a different fix than the display bug though. This change doesn't
> change that if it's already wrong. The display fix should go in alone and
> then if there is an issue with not running things on the right CPU that
> should go in separately.
Makes sense. So the pasted change is fine for me.
Thanks for correcting!
More information about the linux-arm-kernel
mailing list