On Wed, Feb 25, 2026 at 09:29:55PM +0000, Ruslan Valiyev wrote:
Replace sprintf() with sysfs_emit() in state_show() sysfs attribute callbacks in arche-platform.c and arche-apb-ctrl.c.
sysfs_emit() is preferred over sprintf() in sysfs show functions because it is aware of the PAGE_SIZE buffer limit, preventing potential buffer overflows. This addresses checkpatch warnings about the use of sprintf() in sysfs show callbacks.
Signed-off-by: Ruslan Valiyev linuxoid@gmail.com
I really want these sorts of patches to have some kind of analysis whether the "potential buffer overflows" are actual buffer overflows or not. In this case, it's really easy to see that there are no buffer overflows so it feels petty for something I can see just by glancing at the patch... I just got finished asking for the same thing from someone else, but in that case I had to look up the buffer size.
Anyway, just add a sentence at the start which says that "This code is obviously safe". And remove the bits which mention "potential buffer overflows".
Checkpatch complains about code using sprintf(). This code here is obviously safe as-is, but it would be more appropriate to use sysfs_emit().
regards, dan carpenter