[igt-dev] [PATCH v2 3/4] tests/kms_atomic: Initialize array values before checking them

Rodrigo Siqueira Rodrigo.Siqueira at amd.com
Wed Aug 25 14:36:57 UTC 2021


Currently, the subtest plane-immutable-zpos fails due to a lack of
initialization of a set of arrays allocated in the stack. Later on in
the test, there is a check if some of the array components are NULL
which is always false because of the random values in the memory. This
commit fixes this issue by initializing all arrays with zero at the
beginning of the plane_immutable_zpos function, and now it passes for
amdgpu.

Cc: Harry Wentland <harry.wentland at amd.com>
Cc: Nicholas Choi <Nicholas.Choi at amd.com>
Cc: Sean Paul <seanpaul at chromium.org>
Cc: Mark Yacoub <markyacoub at chromium.org>
Cc: Melissa Wen <melissa.srw at gmail.com>
Cc: Arkadiusz Hiler <arek at hiler.eu>
Cc: Petri Latvala <petri.latvala at intel.com>
Signed-off-by: Rodrigo Siqueira <Rodrigo.Siqueira at amd.com>
---
 tests/kms_atomic.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tests/kms_atomic.c b/tests/kms_atomic.c
index 81e20099..1e1bee4d 100644
--- a/tests/kms_atomic.c
+++ b/tests/kms_atomic.c
@@ -374,6 +374,8 @@ plane_immutable_zpos(igt_display_t *display, igt_pipe_t *pipe,
 	struct igt_fb fb_lower, fb_upper;
 	uint32_t w_lower, h_lower, w_upper, h_upper;
 
+	memset(plane_ptr, 0, n_planes * sizeof(igt_plane_t *));
+
 	igt_require(n_planes >= 2);
 
 	mode = igt_output_get_mode(output);
-- 
2.25.1



More information about the igt-dev mailing list