Re: [PATCH] platform/x86: dell-wmi-sysman: Use sysfs_emit{_at} in show functions
From: Thorsten Blum
Date: Thu Mar 05 2026 - 08:05:07 EST
On 5. Mar 2026, at 13:48, Ilpo Järvinen wrote:
> On Thu, 5 Mar 2026, Thorsten Blum wrote:
>> Replace sprintf() with sysfs_emit() and sysfs_emit_at() in sysfs show
>> functions. sysfs_emit() and sysfs_emit_at() are preferred for formatting
>> sysfs output because they provide safer bounds checking.
>>
>> In reset_bios_show(), use sysfs_emit_at() to avoid manual buffer size
>> accounting.
>>
>> Signed-off-by: Thorsten Blum <thorsten.blum@xxxxxxxxx>
>> ---
>> .../platform/x86/dell/dell-wmi-sysman/sysman.c | 18 ++++++++----------
>> 1 file changed, 8 insertions(+), 10 deletions(-)
>> [...]
>> + for (i = 0; i < MAX_TYPES; i++)
>> + len += sysfs_emit_at(buf, len, i == reset_option ? "[%s] " : "%s ",
>
> Are all checkers okay with this construct? IIRC something doesn't
> like having such logic in where only a formatting string is expected.
You mean checkpatch? No warnings, but I can split it again if needed.
Thanks,
Thorsten