public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fbdev: replace snprintf in show functions with sysfs_emit
@ 2021-11-30  0:05 davidcomponentone
  2021-11-30  7:08 ` Greg KH
  0 siblings, 1 reply; 2+ messages in thread
From: davidcomponentone @ 2021-11-30  0:05 UTC (permalink / raw)
  To: ducheng2
  Cc: davidcomponentone, tzimmermann, penguin-kernel, gregkh, cssk,
	yang.guang5, dri-devel, linux-fbdev, linux-kernel, Zeal Robot

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

coccinelle report:
./drivers/video/fbdev/core/fbcon.c:2680:8-16:
WARNING: use scnprintf or sprintf
./drivers/video/fbdev/core/fbcon.c:2655: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/video/fbdev/core/fbcon.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c
index 99ecd9a6d844..b4234ec2f047 100644
--- a/drivers/video/fbdev/core/fbcon.c
+++ b/drivers/video/fbdev/core/fbcon.c
@@ -2652,7 +2652,7 @@ static ssize_t show_rotate(struct device *device,
 	rotate = fbcon_get_rotate(info);
 err:
 	console_unlock();
-	return snprintf(buf, PAGE_SIZE, "%d\n", rotate);
+	return sysfs_emit(buf, "%d\n", rotate);
 }
 
 static ssize_t show_cursor_blink(struct device *device,
@@ -2677,7 +2677,7 @@ static ssize_t show_cursor_blink(struct device *device,
 	blink = (ops->flags & FBCON_FLAGS_CURSOR_TIMER) ? 1 : 0;
 err:
 	console_unlock();
-	return snprintf(buf, PAGE_SIZE, "%d\n", blink);
+	return sysfs_emit(buf, "%d\n", blink);
 }
 
 static ssize_t store_cursor_blink(struct device *device,
-- 
2.30.2


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

* Re: [PATCH] fbdev: replace snprintf in show functions with sysfs_emit
  2021-11-30  0:05 [PATCH] fbdev: replace snprintf in show functions with sysfs_emit davidcomponentone
@ 2021-11-30  7:08 ` Greg KH
  0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2021-11-30  7:08 UTC (permalink / raw)
  To: davidcomponentone
  Cc: ducheng2, tzimmermann, penguin-kernel, cssk, yang.guang5,
	dri-devel, linux-fbdev, linux-kernel, Zeal Robot

On Tue, Nov 30, 2021 at 08:05:08AM +0800, davidcomponentone@gmail.com wrote:
> From: Yang Guang <yang.guang5@zte.com.cn>
> 
> coccinelle report:
> ./drivers/video/fbdev/core/fbcon.c:2680:8-16:
> WARNING: use scnprintf or sprintf
> ./drivers/video/fbdev/core/fbcon.c:2655: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>

As said before, your email does not match these lines, nor was this
reported by this bot, but by the existing tools in the kernel tree.

thanks,

greg k-h

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

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

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-11-30  0:05 [PATCH] fbdev: replace snprintf in show functions with sysfs_emit davidcomponentone
2021-11-30  7:08 ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox