drm/tests: Zero initialize fourccs_out
authorArthur Grillo <arthurgrillo@riseup.net>
Fri, 1 Sep 2023 18:52:56 +0000 (15:52 -0300)
committerMaíra Canal <mairacanal@riseup.net>
Fri, 8 Sep 2023 20:38:19 +0000 (17:38 -0300)
fourccs_out array is not initialized. As the
drm_fb_build_fourcc_list() doesn't necessarily change all the array,
and the test compares all of it, the comparison could fail if the
array is not initialized. Zero initialize the array to fix this.

Fixes: 371e0b186a13 ("drm/tests: Add KUnit tests for drm_fb_build_fourcc_list()")
Signed-off-by: Arthur Grillo <arthurgrillo@riseup.net>
Reviewed-by: Maíra Canal <mairacanal@riseup.net>
Signed-off-by: Maíra Canal <mairacanal@riseup.net>
Link: https://patchwork.freedesktop.org/patch/msgid/20230901-zero-init-fourcc-list-test-v1-1-68bc4cc738c8@riseup.net
drivers/gpu/drm/tests/drm_format_helper_test.c

index 79bc9d4bbd716b799990d88e7e83cd3f6226125e..1a6bd291345de7ad4ce31c2692d7fe1d93c0337f 100644 (file)
@@ -1165,7 +1165,7 @@ KUNIT_ARRAY_PARAM(fb_build_fourcc_list, fb_build_fourcc_list_cases, fb_build_fou
 static void drm_test_fb_build_fourcc_list(struct kunit *test)
 {
        const struct fb_build_fourcc_list_case *params = test->param_value;
-       u32 fourccs_out[TEST_BUF_SIZE];
+       u32 fourccs_out[TEST_BUF_SIZE] = {0};
        size_t nfourccs_out;
        struct drm_device *drm;
        struct device *dev;