linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fbdev/offb: Simplify offb_init_fb()
@ 2023-10-21  6:53 Christophe JAILLET
  2023-10-21 10:20 ` Helge Deller
  0 siblings, 1 reply; 2+ messages in thread
From: Christophe JAILLET @ 2023-10-21  6:53 UTC (permalink / raw)
  To: Helge Deller
  Cc: linux-kernel, kernel-janitors, Christophe JAILLET, linux-fbdev,
	dri-devel

Turn a strcpy()+strncat()+'\0' into an equivalent snprintf().

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
This patch is *not* even compile tested because cross-compiling leads to
some errors like on my machine:
   cc1: error: cannot load plugin ./scripts/gcc-plugins/randomize_layout_plugin.so: ./scripts/gcc-plugins/randomize_layout_plugin.so: undefined symbol: _ZNK6frange6acceptERK14vrange_visitor

So review with care!
---
 drivers/video/fbdev/offb.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/video/fbdev/offb.c b/drivers/video/fbdev/offb.c
index dcb1b81d35db..b421b46d88ef 100644
--- a/drivers/video/fbdev/offb.c
+++ b/drivers/video/fbdev/offb.c
@@ -423,11 +423,9 @@ static void offb_init_fb(struct platform_device *parent, const char *name,
 	fix = &info->fix;
 	var = &info->var;
 
-	if (name) {
-		strcpy(fix->id, "OFfb ");
-		strncat(fix->id, name, sizeof(fix->id) - sizeof("OFfb "));
-		fix->id[sizeof(fix->id) - 1] = '\0';
-	} else
+	if (name)
+		snprintf(fix->id, sizeof(fix->id), "OFfb %s", name);
+	else
 		snprintf(fix->id, sizeof(fix->id), "OFfb %pOFn", dp);
 
 
-- 
2.34.1


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

* Re: [PATCH] fbdev/offb: Simplify offb_init_fb()
  2023-10-21  6:53 [PATCH] fbdev/offb: Simplify offb_init_fb() Christophe JAILLET
@ 2023-10-21 10:20 ` Helge Deller
  0 siblings, 0 replies; 2+ messages in thread
From: Helge Deller @ 2023-10-21 10:20 UTC (permalink / raw)
  To: Christophe JAILLET; +Cc: linux-kernel, kernel-janitors, linux-fbdev, dri-devel

On 10/21/23 08:53, Christophe JAILLET wrote:
> Turn a strcpy()+strncat()+'\0' into an equivalent snprintf().
>
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>

applied.
Thanks!
Helge


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

end of thread, other threads:[~2023-10-21 10:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-21  6:53 [PATCH] fbdev/offb: Simplify offb_init_fb() Christophe JAILLET
2023-10-21 10:20 ` Helge Deller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).