drm/tests: Zero initialize fourccs_out
Subsystems (2)
PATCH 1/1 drm/tests: Zero initialize fourccs_out
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.
--- drivers/gpu/drm/tests/drm_format_helper_test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/tests/drm_format_helper_test.c +1 -1
@@ -1165,7 +1165,7 @@ KUNIT_ARRAY_PARAM(fb_build_fourcc_list, fb_build_fourcc_list_cases, fb_build_foustatic 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;
---
base-commit: 8e455145d8f163aefa6b9cc29478e0a9f82276e6
change-id: 20230901-zero-init-fourcc-list-test-2c934b6b7eb8
Best regards,
Signature · 1 line
Arthur Grillo <[email protected]>
Quoted 7 lines · Arthur Grillo
fourccs_outarray is not initialized. As thedrm_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 <[email protected]>
Best Regards,
- Maíra
Quoted 23 lines
--- drivers/gpu/drm/tests/drm_format_helper_test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/tests/drm_format_helper_test.c +1
-2@@ -1165,7 +1165,7 @@ KUNIT_ARRAY_PARAM(fb_build_fourcc_list, fb_build_fourcc_list_cases, fb_build_foustatic 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; ---base-commit:
8e455145d8f163aefa6b9cc29478e0a9f82276e6
change-id: 20230901-zero-init-fourcc-list-test-2c934b6b7eb8Best regards,
Maira Canal
AppliedHi Arthur,
Quoted 7 lines · Arthur Grillo
fourccs_outarray is not initialized. As thedrm_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 <[email protected]>
Applied to drm-misc/drm-misc-next!
Thanks!
- Maíra
Quoted 23 lines
--- drivers/gpu/drm/tests/drm_format_helper_test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/tests/drm_format_helper_test.c +1
-2@@ -1165,7 +1165,7 @@ KUNIT_ARRAY_PARAM(fb_build_fourcc_list, fb_build_fourcc_list_cases, fb_build_foustatic 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; ---base-commit:
8e455145d8f163aefa6b9cc29478e0a9f82276e6
change-id: 20230901-zero-init-fourcc-list-test-2c934b6b7eb8Best regards,