[igt-dev] [PATCH i-g-t 1/2] lib/kms: Range check pipe before lookup

Petri Latvala petri.latvala at intel.com
Thu Nov 19 10:42:17 UTC 2020


On Thu, Nov 19, 2020 at 09:43:17AM +0000, Chris Wilson wrote:
> Make sure the lookup index is within the range of the table before
> accessing.
> 
> Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> ---
>  lib/igt_kms.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/igt_kms.c b/lib/igt_kms.c
> index e5d8e82c9..9175e50fe 100644
> --- a/lib/igt_kms.c
> +++ b/lib/igt_kms.c
> @@ -1902,7 +1902,7 @@ static void igt_fill_display_format_mod(igt_display_t *display);
>   */
>  void igt_require_pipe(igt_display_t *display, enum pipe pipe)
>  {
> -	igt_skip_on_f(!display->pipes[pipe].enabled,
> +	igt_skip_on_f(pipe >= display->n_pipes || !display->pipes[pipe].enabled,
>  			"Pipe %s does not exist or not enabled\n",
>  			kmstest_pipe_name(pipe));

Ok, kmstest_pipe_name handles all pipe values.

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


>  }
> -- 
> 2.29.2
> 
> _______________________________________________
> 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