netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: atm: use sysfs_emit_at() instead of scnprintf()
@ 2025-03-17  7:51 tang.dongxing
  2025-03-17  8:16 ` Krzysztof Kozlowski
  0 siblings, 1 reply; 6+ messages in thread
From: tang.dongxing @ 2025-03-17  7:51 UTC (permalink / raw)
  To: davem
  Cc: edumazet, kuba, pabeni, horms, tang.dongxing, netdev,
	linux-kernel, yang.guang5, yang.yang29, ye.xingchen, xu.xin16

From: TangDongxing <tang.dongxing@zte.com.cn>

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@zte.com.cn>
---
 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

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-03-25 15:27 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-17  7:51 [PATCH] net: atm: use sysfs_emit_at() instead of scnprintf() tang.dongxing
2025-03-17  8:16 ` Krzysztof Kozlowski
2025-03-17  9:09   ` tang.dongxing
2025-03-20 11:42     ` Simon Horman
2025-03-21  2:45       ` tang.dongxing
2025-03-25 15:27         ` Simon Horman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).