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

Petri Latvala petri.latvala at intel.com
Thu Nov 19 09:00:29 UTC 2020


On Thu, Nov 19, 2020 at 10:53:04AM +0200, Petri Latvala wrote:
> 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?

Correction, it is. But n_pipes is not the amount of pipes as reported
by count_crtcs, it's IGT_MAX_PIPES.

So who's calling this with 'pipe' that's >= IGT_MAX_PIPES?


-- 
Petri Latvala


More information about the igt-dev mailing list