Re: [PATCH] accel: goya: replace sprintf() with sysfs_emit()
From: Sinyuk, Konstantin
Date: Sat Nov 29 2025 - 15:35:26 EST
On 10/30/2025 8:35 PM, Shi Hao wrote:
> Replace deprecated sprintf() with sysfs_emit() in various sysfs show
> functions to avoid buffer overflows.
>
> The sysfs_emit() function is specifically designed for sysfs show handlers
> and provides built-in bounds checking by limiting output to PAGE_SIZE,
> unlike sprintf() which has no bounds checking. This prevents buffer
> overflows that could result in kernel crashes or potential security
> vulnerabilities.
>
> Convert sprintf() to sysfs_emit() as per kernel code practices and
> guidelines.
>
> Signed-off-by: Shi Hao <i.shihao.999@xxxxxxxxx>
Applied to accel/habanalabs-next, thanks.