mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] drm/fb-helper: use strscpy() instead of strcpy()
@ 2026-08-31 14:44 Hrushiraj Gandhi
  0 siblings, 0 replies; only message in thread
From: Hrushiraj Gandhi @ 2026-08-31 14:44 UTC (permalink / raw)
  To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann
  Cc: David Airlie, Simona Vetter, dri-devel, linux-kernel, Hrushiraj Gandhi

strcpy() has no notion of the destination buffer's size, so it will
write past the end of fb_helper->fb->comm if the source string is
ever longer than expected. It isn't here today ("[fbcon]" always
fits), but strscpy() is the bounded, always-NUL-terminating
replacement recommended for all new and existing strcpy() users, so
convert this one too. fb->comm is a fixed-size array, so the
destination size can be derived automatically.

No functional change.

Signed-off-by: Hrushiraj Gandhi <hrushirajg23@gmail.com>
---
 drivers/gpu/drm/drm_fb_helper.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index 80ca785bdb26..175311fac2e4 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -1545,7 +1545,7 @@ static int drm_fb_helper_single_fb_probe(struct drm_fb_helper *fb_helper)
 	if (ret < 0)
 		return ret;
 
-	strcpy(fb_helper->fb->comm, "[fbcon]");
+	strscpy(fb_helper->fb->comm, "[fbcon]");
 
 	return 0;
 }

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-08-31 14:44 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-31 14:44 [PATCH] drm/fb-helper: use strscpy() instead of strcpy() Hrushiraj Gandhi

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

all inboxes | Powered by JetHome®