[PATCH] usbip: vudc: Replace snprintf in show functions with sysfs_emit

Subsystems: the rest, usb over ip driver, usb subsystem

STALE1734d

2 messages, 2 authors, 2021-11-10 · open the first message on its own page

[PATCH] usbip: vudc: Replace snprintf in show functions with sysfs_emit

From: <hidden>
Date: 2021-11-10 02:32:51

From: Jing Yao <redacted>

coccicheck complains about the use of snprintf() in sysfs show
functions:
WARNING use scnprintf or sprintf

Use sysfs_emit instead of scnprintf, snprintf or sprintf makes more
sense.

Reported-by: Zeal Robot <redacted>
Signed-off-by: Jing Yao <redacted>
---
 drivers/usb/usbip/vudc_sysfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/usb/usbip/vudc_sysfs.c b/drivers/usb/usbip/vudc_sysfs.c
index d1cf6b51bf85..6af594bd3d5e 100644
--- a/drivers/usb/usbip/vudc_sysfs.c
+++ b/drivers/usb/usbip/vudc_sysfs.c
@@ -242,7 +242,7 @@ static ssize_t usbip_status_show(struct device *dev,
 	status = udc->ud.status;
 	spin_unlock_irq(&udc->ud.lock);
 
-	return snprintf(out, PAGE_SIZE, "%d\n", status);
+	return sysfs_emit(out, "%d\n", status);
 }
 static DEVICE_ATTR_RO(usbip_status);
 
-- 
2.25.1

Re: [PATCH] usbip: vudc: Replace snprintf in show functions with sysfs_emit

From: Greg KH <gregkh@linuxfoundation.org>
Date: 2021-11-10 08:11:06

On Wed, Nov 10, 2021 at 02:32:44AM +0000, cgel.zte@gmail.com wrote:
From: Jing Yao <redacted>

coccicheck complains about the use of snprintf() in sysfs show
functions:
WARNING use scnprintf or sprintf

Use sysfs_emit instead of scnprintf, snprintf or sprintf makes more
sense.

Reported-by: Zeal Robot <redacted>
Signed-off-by: Jing Yao <redacted>
Again, same coments as on the staging driver change.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help