CC: [email protected]
CC: [email protected]
TO: Denis Efremov <[email protected]>
CC: Julia Lawall <[email protected]>
CC: Valentina Manea <[email protected]>
CC: Shuah Khan <[email protected]>
CC: "Greg Kroah-Hartman" <[email protected]>
CC: [email protected]
CC: [email protected]

From: kernel test robot <[email protected]>

drivers/usb/usbip/stub_dev.c:33:8-16: WARNING: use scnprintf or sprintf


 From Documentation/filesystems/sysfs.txt:
  show() must not use snprintf() when formatting the value to be
  returned to user space. If you can guarantee that an overflow
  will never happen you can use sprintf() otherwise you must use
  scnprintf().

Generated by: scripts/coccinelle/api/device_attr_show.cocci

Fixes: abfc19ff202d ("coccinelle: api: add device_attr_show script")
CC: Denis Efremov <[email protected]>
Signed-off-by: kernel test robot <[email protected]>
---

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   fc4f28bb3daf3265d6bc5f73b497306985bb23ab
commit: abfc19ff202d287742483e15fd478ddd6ada2187 coccinelle: api: add 
device_attr_show script
:::::: branch date: 9 hours ago
:::::: commit date: 6 weeks ago

Please take the patch only if it's a positive warning. Thanks!

 stub_dev.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/usb/usbip/stub_dev.c
+++ b/drivers/usb/usbip/stub_dev.c
@@ -30,7 +30,7 @@ static ssize_t usbip_status_show(struct
        status = sdev->ud.status;
        spin_unlock_irq(&sdev->ud.lock);
 
-       return snprintf(buf, PAGE_SIZE, "%d\n", status);
+       return scnprintf(buf, PAGE_SIZE, "%d\n", status);
 }
 static DEVICE_ATTR_RO(usbip_status);
 
_______________________________________________
kbuild mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to