[PATCH] net: atm: use sysfs_emit_at() instead of scnprintf()

From: tang.dongxing
Date: Mon Mar 17 2025 - 03:51:28 EST


From: TangDongxing <tang.dongxing@xxxxxxxxxx>

Follow the advice in Documentation/filesystems/sysfs.rst:
show() should only use sysfs_emit() or sysfs_emit_at() when formatting
the value to be returned to user space.

Signed-off-by: TangDongxing <tang.dongxing@xxxxxxxxxx>
---
net/atm/atm_sysfs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/atm/atm_sysfs.c b/net/atm/atm_sysfs.c
index 54e7fb1a4ee5..d06ffadc5139 100644
--- a/net/atm/atm_sysfs.c
+++ b/net/atm/atm_sysfs.c
@@ -37,7 +37,7 @@ static ssize_t atmaddress_show(struct device *cdev,

spin_lock_irqsave(&adev->lock, flags);
list_for_each_entry(aaddr, &adev->local, entry) {
- count += scnprintf(buf + count, PAGE_SIZE - count,
+ count += sysfs_emit_at(buf, count,
"%1phN.%2phN.%10phN.%6phN.%1phN\n",
&aaddr->addr.sas_addr.prv[0],
&aaddr->addr.sas_addr.prv[1],
--
2.25.1