All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] usbip: vudc: Replace snprintf in show functions with  sysfs_emit
@ 2021-11-10  2:32 cgel.zte
  2021-11-10  8:11 ` Greg KH
  0 siblings, 1 reply; 2+ messages in thread
From: cgel.zte @ 2021-11-10  2:32 UTC (permalink / raw)
  To: valentina.manea.m
  Cc: shuah, gregkh, linux-usb, linux-kernel, Jing Yao, Zeal Robot

From: Jing Yao <yao.jing2@zte.com.cn>

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 <zealci@zte.com.cn>
Signed-off-by: Jing Yao <yao.jing2@zte.com.cn>
---
 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


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

* Re: [PATCH] usbip: vudc: Replace snprintf in show functions with sysfs_emit
  2021-11-10  2:32 [PATCH] usbip: vudc: Replace snprintf in show functions with sysfs_emit cgel.zte
@ 2021-11-10  8:11 ` Greg KH
  0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2021-11-10  8:11 UTC (permalink / raw)
  To: cgel.zte
  Cc: valentina.manea.m, shuah, linux-usb, linux-kernel, Jing Yao, Zeal Robot

On Wed, Nov 10, 2021 at 02:32:44AM +0000, cgel.zte@gmail.com wrote:
> From: Jing Yao <yao.jing2@zte.com.cn>
> 
> 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 <zealci@zte.com.cn>
> Signed-off-by: Jing Yao <yao.jing2@zte.com.cn>

Again, same coments as on the staging driver change.

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

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

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-10  2:32 [PATCH] usbip: vudc: Replace snprintf in show functions with sysfs_emit cgel.zte
2021-11-10  8:11 ` Greg KH

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.