Re: [PATCH 04/42] arch/x86/events/core: Convert snprintf to sysfs_emit

From: Zhijian Li (Fujitsu)
Date: Tue Jan 16 2024 - 02:37:16 EST


Adrian,

On 16/01/2024 15:01, Adrian Hunter wrote:
>> diff --git a/arch/x86/events/core.c b/arch/x86/events/core.c
>> index 40ad1425ffa2..52e5707be03b 100644
>> --- a/arch/x86/events/core.c
>> +++ b/arch/x86/events/core.c
>> @@ -1892,7 +1892,7 @@ ssize_t events_hybrid_sysfs_show(struct device *dev,
>> if (x86_pmu.hybrid_pmu[i].pmu_type & pmu->pmu_type) {
>> next_str = strchr(str, ';');
>> if (next_str)
>> - return snprintf(page, next_str - str + 1, "%s", str);
>> + return sysfs_emit(page, "%s", str);
> The intention seems to be to print only up to, and not including, the next ';',
> but sysfs_emit() is not going to do that.

Indeed, it intend to print a sub-string only, this conversion was wrong.
Let's leave it alone