Skip to contentSkip to conversation

testdisplay: Fix segfault after first modeset fails

PATCH New Ander Conselvan de Oliveira 1 participant 1 message May 27, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 testdisplay: Fix segfault after first modeset fails

When testing all modes on a connector with a single mode, if the modeset fails, the code attempts to remove fb_info[-1], because old_fb still has the inital value of -1.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=90625

---
 tests/testdisplay.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
tests/testdisplay.c +2 -1
index 9068a95..3dbb638 100644
@@ -367,6 +367,7 @@ set_mode(struct connector *c)
 		if (drmModeSetCrtc(drm_fd, c->crtc, fb_id, 0, 0,
 				   &c->id, 1, &c->mode)) {
 			igt_warn("failed to set mode (%dx%d@%dHz): %s\n", width, height, c->mode.vrefresh, strerror(errno));
+			igt_remove_fb(drm_fd, &fb_info[current_fb]);
 			continue;
 		}
 
@@ -390,7 +391,7 @@ set_mode(struct connector *c)
 		}
 	}
 
-	if (test_all_modes)
+	if (test_all_modes && old_fb != -1)
 		igt_remove_fb(drm_fd, &fb_info[old_fb]);
 
 	drmModeFreeEncoder(c->encoder);
Signature · 6 lines
2.1.0

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx