RE: [PATCH] sysfs: Remove page boundary align limitation on sysfs_emit and sysfs_emit_at

From: Yu, Lang
Date: Thu Sep 09 2021 - 01:31:45 EST


[AMD Official Use Only]



>-----Original Message-----
>From: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
>Sent: Thursday, September 9, 2021 1:19 PM
>To: Yu, Lang <Lang.Yu@xxxxxxx>
>Cc: Joe Perches <joe@xxxxxxxxxxx>; Rafael J . Wysocki <rafael@xxxxxxxxxx>;
>linux-kernel@xxxxxxxxxxxxxxx
>Subject: Re: [PATCH] sysfs: Remove page boundary align limitation on sysfs_emit
>and sysfs_emit_at
>
>On Wed, Sep 08, 2021 at 03:33:51PM +0000, Yu, Lang wrote:
>> >Please feel free to add better documentation for the functions if you
>> >feel people are getting confused, do not change the existing behavior
>> >of the code as it rightly caught it being misused.
>>
>> You can find many patches named "convert sysfs scnprintf/snprintf to
>syfs_emit/sysfs_emit_at".
>> or "use sysfs_emit/sysfs_emit_at in show functions". They may think
>> it's better to use syfs_emit/sysfs_emit_at given its overrun avoidance.
>
>Yes, and using that in sysfs functions is fine, there is nothing wrong with this
>usage.
>
>> But there are still some corner cases(e.g., a non page boundary aligned buf
>address : ).
>
>I need a specific example of where this has gone wrong. Please provide a
>lore.kernel.org link as I fail to see the problem here.
>
>Are you sure that you are not just abusing sysfs and having more than one value
>per file? Does this mean I need to go audit all of the gpu sysfs file entries?
>
Indeed, the one value per file rule was broken... Thanks.

Regard,
Lang

>thanks,
>
>greg k-h