Use strscpy() instead of strcpy() to copy "[fbcon]" into fb->comm.
This prevents possible buffer overflows and ensures proper NUL
termination.

Signed-off-by: Madhur Kumar <[email protected]>
v2: Fixed typo in commit message
---
 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 11a5b60cb9ce..0cd7c3280243 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -1651,7 +1651,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]", sizeof(fb_helper->fb->comm));
 
        info = fb_helper->info;
 
-- 
2.51.0

Reply via email to