Commit af403150 authored by Gabriel Krisman Bertazi's avatar Gabriel Krisman Bertazi Committed by Arkadiusz Hiler

tests/kms_ccs: Prevent segfault if pipe is not supported

for_each_plane_on_pipe() indexes bad memory when iterating over an invalid
pipe.  Make sure the pipe exists before trying to use it.  This prevents
the crash below:

root@ideacentre:~# igt-gpu-tools/tests/kms_ccs --r pipe-D-crc-sprite-planes-basic
IGT-Version: 1.19-g59f0e3d182a8 (x86_64) (Linux: 4.13.0-rc6.intel-boxes+x86_64)
Received signal SIGSEGV.
Stack trace:
 #0 [fatal_sig_handler+0x185]
 #1 [killpg+0x40]
 #2 [__real_main485+0x2de]
 #3 [main+0x3f]
 #4 [__libc_start_main+0xf1]
 #5 [_start+0x2a]
 #6 [<unknown>+0x2a]
Subtest pipe-D-crc-sprite-planes-basic: CRASH (0.004s)
Signed-off-by: default avatarGabriel Krisman Bertazi <krisman@collabora.co.uk>
Reviewed-by: Arkadiusz Hiler's avatarArkadiusz Hiler <arkadiusz.hiler@intel.com>
Reviewed-by: Ben Widawsky's avatarBen Widawsky <ben@bwidawsk.net>
parent 5763c890
......@@ -503,6 +503,9 @@ igt_main
data.flags = TEST_CRC;
igt_subtest_f("pipe-%s-crc-sprite-planes-basic", pipe_name) {
igt_display_require_output_on_pipe(&data.display, data.pipe);
for_each_plane_on_pipe(&data.display, data.pipe, data.plane) {
if (data.plane->type == DRM_PLANE_TYPE_PRIMARY)
continue;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment