[igt-dev] [PATCH i-g-t] tests/kms_3d: fix uninitialized value

Simon Ser simon.ser at intel.com
Thu Aug 29 10:37:45 UTC 2019


If the device doesn't have any HDMI connectors, garbage is read from the stack.

Signed-off-by: Simon Ser <simon.ser at intel.com>
---
 tests/kms_3d.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/tests/kms_3d.c b/tests/kms_3d.c
index b970b3b5521c..2622b2d0a6f3 100644
--- a/tests/kms_3d.c
+++ b/tests/kms_3d.c
@@ -30,7 +30,7 @@ igt_simple_main
 {
 	int drm_fd;
 	drmModeRes *res;
-	drmModeConnector *connector;
+	drmModeConnector *connector = NULL;
 	const struct edid *edid;
 	int mode_count, connector_id;

@@ -43,14 +43,10 @@ igt_simple_main

 	/* find an hdmi connector */
 	for (int i = 0; i < res->count_connectors; i++) {
-
 		connector = drmModeGetConnectorCurrent(drm_fd, res->connectors[i]);
-
 		if (connector->connector_type == DRM_MODE_CONNECTOR_HDMIA)
 			break;
-
 		drmModeFreeConnector(connector);
-
 		connector = NULL;
 	}
 	igt_require(connector);
--
2.23.0



More information about the igt-dev mailing list