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

Petri Latvala petri.latvala at intel.com
Thu Nov 19 08:53:04 UTC 2020


On Thu, Nov 19, 2020 at 08:35:59AM +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));

Who's calling this with an invalid 'pipe' value? display->pipes size
is no longer display->n_pipes, right?


-- 
Petri Latvala


More information about the igt-dev mailing list