]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
ata: libata-transport: replace scnprintf with sysfs_emit for simple attributes
authorJonathan Velez <jonvelez12345@gmail.com>
Wed, 9 Jul 2025 13:33:30 +0000 (13:33 +0000)
committerNiklas Cassel <cassel@kernel.org>
Wed, 9 Jul 2025 13:48:17 +0000 (15:48 +0200)
commit48925ba7dfa7337f54c5bae6738b2f0bb4055b06
treec6e1c6ac137dc20bbc290b201696baa482dd8a08
parentc5fccfe9e4e9d210a7e9de1ecb96c6edc33a518c
ata: libata-transport: replace scnprintf with sysfs_emit for simple attributes

sprintf, snprintf, and scnprintf do not consider the PAGE_SIZE maximum
of the temporary buffer used for outputting sysfs content and they may
overrun the PAGE_SIZE buffer length.

To avoid output defects with the ATA transport class simple attributes,
use sysfs_emit instead of scnprintf().

This aligns with the sysfs guidance provided in
Documentation/filesystems/sysfs.rst.

Signed-off-by: Jonathan Velez <jonvelez12345@gmail.com>
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Link: https://lore.kernel.org/r/20250709133330.3546-1-jonvelez12345@gmail.com
Signed-off-by: Niklas Cassel <cassel@kernel.org>
drivers/ata/libata-transport.c