Re: [PATCH net-next v3] net: bridge: use sysfs_emit instead of sprintf

From: Nikolay Aleksandrov

Date: Tue Feb 03 2026 - 02:52:32 EST


On 02/02/2026 21:09, David Corvaglia wrote:
Replace sprintf with sysfs_emit in sysfs show() methods as outlined in
Documentation/filesystems/sysfs.rst.

sysfs_emit is preferred to sprintf in sysfs show() methods as it is safer
with buffer handling.

Signed-off-by: David Corvaglia <david@xxxxxxxxxxxxx>
---
v3: Fix whitespace issue.
v2: https://lore.kernel.org/bridge/0100019c1d2d46e0-a083f912-ac82-47e8-8cbb-ac9d70355ed3-000000@xxxxxxxxxxxxxxxxxxx/
Fix alignment of sysfs_emit arguments.
v1: https://lore.kernel.org/bridge/0100019c14f90490-950ddd9b-1897-4111-bddd-0d4b8abf380a-000000@xxxxxxxxxxxxxxxxxxx/
This is my first patch to the kernel! I've been able to build and boot
with the patch. I also tested the sysfs reads and they seem to be
correct. Any feedback is appreciated.

net/bridge/br_stp_if.c | 8 +--
net/bridge/br_sysfs_br.c | 108 +++++++++++++++++++--------------------
net/bridge/br_sysfs_if.c | 32 ++++++------
3 files changed, 73 insertions(+), 75 deletions(-)


LGTM
Acked-by: Nikolay Aleksandrov <razor@xxxxxxxxxxxxx>