All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] staging: replace snprintf with sysfs_emit
@ 2021-11-30  0:07 davidcomponentone
  2021-11-30  1:17 ` Joe Perches
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: davidcomponentone @ 2021-11-30  0:07 UTC (permalink / raw)
  To: TheSven73
  Cc: davidcomponentone, gregkh, linux-staging, linux-kernel,
	Yang Guang, Zeal Robot

From: Yang Guang <yang.guang5@zte.com.cn>

coccinelle report:
./drivers/staging/fieldbus/dev_core.c:73:8-16:
WARNING: use scnprintf or sprintf

Use sysfs_emit instead of scnprintf or sprintf makes more sense.

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Yang Guang <yang.guang5@zte.com.cn>
---
 drivers/staging/fieldbus/dev_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/fieldbus/dev_core.c b/drivers/staging/fieldbus/dev_core.c
index 5aab734606ea..01862fe8e4cc 100644
--- a/drivers/staging/fieldbus/dev_core.c
+++ b/drivers/staging/fieldbus/dev_core.c
@@ -70,7 +70,7 @@ static ssize_t card_name_show(struct device *dev, struct device_attribute *attr,
 	 * card_name was provided by child driver, could potentially be long.
 	 * protect against buffer overrun.
 	 */
-	return snprintf(buf, PAGE_SIZE, "%s\n", fb->card_name);
+	return sysfs_emit(buf, "%s\n", fb->card_name);
 }
 static DEVICE_ATTR_RO(card_name);
 
-- 
2.30.2


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

end of thread, other threads:[~2021-11-30 10:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-30  0:07 [PATCH] staging: replace snprintf with sysfs_emit davidcomponentone
2021-11-30  1:17 ` Joe Perches
2021-11-30  6:42 ` Greg KH
2021-11-30  9:35 ` Dan Carpenter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.