diff mbox

[i-g-t] kms_atomic_transition: Initialize pipe_crcs to avoid segfault

Message ID 1487345214-21875-1-git-send-email-brian.starkey@arm.com (mailing list archive)
State New, archived
Headers show

Commit Message

Brian Starkey Feb. 17, 2017, 3:26 p.m. UTC
igt_pipe_crc_new() is skipped for non-Intel devices, but the later calls
to collect_crcs_mask() will attempt to retrieve CRC values if the
pipe_crcs pointers are non-NULL.

Zero-initialise pipe_crcs to avoid accessing garbage pointers on
non-Intel devices.

Signed-off-by: Brian Starkey <brian.starkey@arm.com>
---
 tests/kms_atomic_transition.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Petri Latvala Feb. 20, 2017, 10:48 a.m. UTC | #1
On Fri, Feb 17, 2017 at 03:26:54PM +0000, Brian Starkey wrote:
> igt_pipe_crc_new() is skipped for non-Intel devices, but the later calls
> to collect_crcs_mask() will attempt to retrieve CRC values if the
> pipe_crcs pointers are non-NULL.
> 
> Zero-initialise pipe_crcs to avoid accessing garbage pointers on
> non-Intel devices.
> 
> Signed-off-by: Brian Starkey <brian.starkey@arm.com>

Reviewed-by: Petri Latvala <petri.latvala@intel.com>

Pushed, thanks.




> ---
>  tests/kms_atomic_transition.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tests/kms_atomic_transition.c b/tests/kms_atomic_transition.c
> index ba8c8b5ca02b..1599f0b36c4e 100644
> --- a/tests/kms_atomic_transition.c
> +++ b/tests/kms_atomic_transition.c
> @@ -608,7 +608,7 @@ static void run_modeset_tests(igt_display_t *display, int howmany, bool nonblock
>  	struct igt_fb fbs[2];
>  	int i, j;
>  	unsigned iter_max = 1 << display->n_pipes;
> -	igt_pipe_crc_t *pipe_crcs[I915_MAX_PIPES];
> +	igt_pipe_crc_t *pipe_crcs[I915_MAX_PIPES] = { 0 };
>  	igt_output_t *output;
>  	unsigned width = 0, height = 0;
>  	bool skip_test = false;
> -- 
> 1.7.9.5
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
diff mbox

Patch

diff --git a/tests/kms_atomic_transition.c b/tests/kms_atomic_transition.c
index ba8c8b5ca02b..1599f0b36c4e 100644
--- a/tests/kms_atomic_transition.c
+++ b/tests/kms_atomic_transition.c
@@ -608,7 +608,7 @@  static void run_modeset_tests(igt_display_t *display, int howmany, bool nonblock
 	struct igt_fb fbs[2];
 	int i, j;
 	unsigned iter_max = 1 << display->n_pipes;
-	igt_pipe_crc_t *pipe_crcs[I915_MAX_PIPES];
+	igt_pipe_crc_t *pipe_crcs[I915_MAX_PIPES] = { 0 };
 	igt_output_t *output;
 	unsigned width = 0, height = 0;
 	bool skip_test = false;