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

Petri Latvala petri.latvala at intel.com
Thu Aug 29 11:03:33 UTC 2019


On Thu, Aug 29, 2019 at 01:37:45PM +0300, Simon Ser wrote:
> 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>

Reviewed-by: Petri Latvala <petri.latvala 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
> 
> _______________________________________________
> igt-dev mailing list
> igt-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/igt-dev


More information about the igt-dev mailing list