diff mbox series

[v2,03/11] drm/tests: Replace strcpy to strscpy on drm_test_framebuffer_create test

Message ID 20231024191002.1620-4-gcarlos@disroot.org (mailing list archive)
State New, archived
Headers show
Series Increase coverage on drm_framebuffer.c | expand

Commit Message

Carlos Eduardo Gallo Filho Oct. 24, 2023, 7:09 p.m. UTC
Replace the use of strcpy to strscpy on the test_to_desc of the
drm_test_framebuffer_create test for better security and reliability.

Signed-off-by: Carlos Eduardo Gallo Filho <gcarlos@disroot.org>
---
 drivers/gpu/drm/tests/drm_framebuffer_test.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Maxime Ripard Oct. 25, 2023, 2:35 p.m. UTC | #1
On Tue, 24 Oct 2023 16:09:54 -0300, Carlos Eduardo Gallo Filho wrote:
> Replace the use of strcpy to strscpy on the test_to_desc of the
> drm_test_framebuffer_create test for better security and reliability.
> 
> Signed-off-by: Carlos Eduardo Gallo Filho <gcarlos@disroot.org>

Acked-by: Maxime Ripard <mripard@kernel.org>

Thanks!
Maxime
diff mbox series

Patch

diff --git a/drivers/gpu/drm/tests/drm_framebuffer_test.c b/drivers/gpu/drm/tests/drm_framebuffer_test.c
index 659cbd5a3be3..eb76a71644e9 100644
--- a/drivers/gpu/drm/tests/drm_framebuffer_test.c
+++ b/drivers/gpu/drm/tests/drm_framebuffer_test.c
@@ -397,7 +397,7 @@  static void drm_test_framebuffer_create(struct kunit *test)
 
 static void drm_framebuffer_test_to_desc(const struct drm_framebuffer_test *t, char *desc)
 {
-	strcpy(desc, t->name);
+	strscpy(desc, t->name, KUNIT_PARAM_DESC_SIZE);
 }
 
 KUNIT_ARRAY_PARAM(drm_framebuffer_create, drm_framebuffer_create_cases,