drivers/video/fbdev/core/fbcon.c:3509:8-16: WARNING: use scnprintf or sprintf
Subsystems (3)
kernel test robot
build bottree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master head: fc80c51fd4b23ec007e88d4c688f2cac1b8648e7 commit: abfc19ff202d287742483e15fd478ddd6ada2187 coccinelle: api: add device_attr_show script date: 6 days ago config: parisc-randconfig-c003-20200810 (attached as .config) compiler: hppa-linux-gcc (GCC) 9.3.0
If you fix the issue, kindly add following tag as appropriate
coccinelle warnings: (new ones prefixed by >>)
>> drivers/video/fbdev/core/fbcon.c:3509:8-16: WARNING: use scnprintf or sprintf drivers/video/fbdev/core/fbcon.c:3484:8-16: WARNING: use scnprintf or sprintf -- >> drivers/tty/vt/vt.c:3820:8-16: WARNING: use scnprintf or sprintf
drivers/tty/vt/vt.c:3828:8-16: WARNING: use scnprintf or sprintf
Please review and possibly fold the followup patch.
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
kernel test robot
build bot[PATCH] coccinelle: api: fix device_attr_show.cocci warnings
drivers/video/fbdev/core/fbcon.c:3509:8-16: WARNING: use scnprintf or sprintf drivers/video/fbdev/core/fbcon.c:3484:8-16: WARNING: use scnprintf or sprintf
From: kernel test robot <[email protected]>
drivers/video/fbdev/core/fbcon.c:3509:8-16: WARNING: use scnprintf or sprintf drivers/video/fbdev/core/fbcon.c:3484: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
---
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master head: fc80c51fd4b23ec007e88d4c688f2cac1b8648e7 commit: abfc19ff202d287742483e15fd478ddd6ada2187 coccinelle: api: add device_attr_show script
Please take the patch only if it's a positive warning. Thanks!
fbcon.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/video/fbdev/core/fbcon.c +2 -2
@@ -3481,7 +3481,7 @@ static ssize_t show_rotate(struct device rotate =fbcon_get_rotate (info); err:console_unlock (); -return snprintf (buf,PAGE_SIZE ,"%d\n" , rotate); +return scnprintf (buf,PAGE_SIZE ,"%d\n" , rotate); } static ssize_t show_cursor_blink(struct device *device,
@@ -3506,7 +3506,7 @@ static ssize_t show_cursor_blink(struct blink = (ops->flags &FBCON_FLAGS_CURSOR_TIMER ) ?1 :0 ; err:console_unlock (); -return snprintf (buf,PAGE_SIZE ,"%d\n" , blink); +return scnprintf (buf,PAGE_SIZE ,"%d\n" , blink); } static ssize_t store_cursor_blink(struct device *device,
Re: [PATCH] coccinelle: api: fix device_attr_show.cocci warnings
Hi,
Quoted 31 lines · kernel test robot
From: kernel test robot <[email protected]>
drivers/video/fbdev/core/fbcon.c:3509:8-16: WARNING: use scnprintf or sprintf drivers/video/fbdev/core/fbcon.c:3484:8-16: WARNING: use scnprintf or sprintf
From
Documentation/filesystems/sysfs.txt:
show()must not usesnprintf()when formatting the value to be returned to user space. If you can guarantee that an overflow will never happen you can usesprintf()otherwise you must usescnprintf().Generated by:
scripts/coccinelle/api/device_attr_show.cocciFixes 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: fc80c51fd4b23ec007e88d4c688f2cac1b8648e7 commit: abfc19ff202d287742483e15fd478ddd6ada2187 coccinelle: api: add device_attr_show scriptPlease take the patch only if it's a positive warning. Thanks!
fbcon.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/video/fbdev/core/fbcon.c static ssize_t show_rotate(struct device · line 3484
Quoted 5 lines
drivers/video/fbdev/core/fbcon.c +1
-1@@ -3481,7 +3481,7 @@ static ssize_t show_rotate(struct device rotate =fbcon_get_rotate (info); err:console_unlock (); -return snprintf (buf,PAGE_SIZE ,"%d\n" , rotate); +return scnprintf (buf,PAGE_SIZE ,"%d\n" , rotate);
buf length is at least PAGE_SIZE and rotate val is an int so shouldn't this be converted to use sprintf() instead?
drivers/video/fbdev/core/fbcon.c static ssize_t show_cursor_blink(struct · line 3509
Quoted 9 lines
drivers/video/fbdev/core/fbcon.c +1
-1} static ssize_t show_cursor_blink(struct device *device,@@ -3506,7 +3506,7 @@ static ssize_t show_cursor_blink(struct blink = (ops->flags &FBCON_FLAGS_CURSOR_TIMER ) ?1 :0 ; err:console_unlock (); -return snprintf (buf,PAGE_SIZE ,"%d\n" , blink); +return scnprintf (buf,PAGE_SIZE ,"%d\n" , blink);
ditto for blink val
drivers/video/fbdev/core/fbcon.c static ssize_t show_cursor_blink(struct · line 3512
Quoted 4 lines
drivers/video/fbdev/core/fbcon.c +0
-0} static ssize_t store_cursor_blink(struct device *device,
Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics
Re: [kbuild-all] Re: [PATCH] coccinelle: api: fix device_attr_show.cocci warnings
Quoted 32 lines · Bartlomiej Zolnierkiewicz
Hi,
Quoted 28 lines · kernel test robot
From: kernel test robot <[email protected]>
drivers/video/fbdev/core/fbcon.c:3509:8-16: WARNING: use scnprintf or sprintf drivers/video/fbdev/core/fbcon.c:3484:8-16: WARNING: use scnprintf or sprintf
From
Documentation/filesystems/sysfs.txt:
show()must not usesnprintf()when formatting the value to be returned to user space. If you can guarantee that an overflow will never happen you can usesprintf()otherwise you must usescnprintf().Generated by:
scripts/coccinelle/api/device_attr_show.cocciFixes 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: fc80c51fd4b23ec007e88d4c688f2cac1b8648e7 commit: abfc19ff202d287742483e15fd478ddd6ada2187 coccinelle: api: add device_attr_show scriptPlease take the patch only if it's a positive warning. Thanks!
fbcon.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Quoted 11 lines
drivers/video/fbdev/core/fbcon.c static ssize_t show_rotate(struct device · line 3484
Quoted 8 lines
drivers/video/fbdev/core/fbcon.c +1
-1@@ -3481,7 +3481,7 @@ static ssize_t show_rotate(struct device rotate =fbcon_get_rotate (info); err:console_unlock (); -return snprintf (buf,PAGE_SIZE ,"%d\n" , rotate); +return scnprintf (buf,PAGE_SIZE ,"%d\n" , rotate);buf length is at least
PAGE_SIZEand rotate val is an int so shouldn't this be converted to usesprintf()instead?
The rule is evolving in this direction. Thanks for the feedback.
julia
Quoted 27 lines
drivers/video/fbdev/core/fbcon.c static ssize_t show_cursor_blink(struct · line 3509
Quoted 10 lines
drivers/video/fbdev/core/fbcon.c +1
-1} static ssize_t show_cursor_blink(struct device *device,@@ -3506,7 +3506,7 @@ static ssize_t show_cursor_blink(struct blink = (ops->flags &FBCON_FLAGS_CURSOR_TIMER ) ?1 :0 ; err:console_unlock (); -return snprintf (buf,PAGE_SIZE ,"%d\n" , blink); +return scnprintf (buf,PAGE_SIZE ,"%d\n" , blink);ditto for blink val
drivers/video/fbdev/core/fbcon.c static ssize_t show_cursor_blink(struct · line 3512
Quoted 4 lines
drivers/video/fbdev/core/fbcon.c +0
-0} static ssize_t store_cursor_blink(struct device *device,Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics
_______________________________________________
kbuild-all mailing list -- kbuild-all(a)lists.01.org To unsubscribe send an email to kbuild-all-leave(a)lists.01.org