On Tue, May 09, 2017 at 03:08:33PM -0700, Aaron Plattner wrote:
> Commit 112d0d7d01b9 lost the initialization of the variable i in the loop to 
> add
> secondary driver matches to the list of configs:
> 
>  @@ -398,8 +412,8 @@ autoConfigDevice(GDevPtr preconf_device)
> 
>               /* for each other driver found, copy the first screen, insert it
>                * into the list of screens and set the driver */
>  -            for (i = 1; i < num_matches; i++) {
>  -                if (!copyScreen(slp[0].screen, ptr, i, matches[i]))
>  +            while (i++ < md.nmatches) {
>  +                if (!copyScreen(slp[0].screen, ptr, i, md.matches[i]))
>                       return NULL;
>               }
> 
> This caused only the first match to be added, because an earlier loop sets i =
> md.nmatches.
> 
> Fix this by reverting the while loop back to a for loop.
> 
> Reported-by: Michel Dänzer <mic...@daenzer.net>
> Reported-by: Peter Hutterer <peter.hutte...@who-t.net>
> Reported-by: Eric Anholt <e...@anholt.net>
> Cc: Adam Jackson <a...@redhat.com>
> Fixes: 112d0d7d01b9 ("xfree86: Improved autoconfig drivers matching")
> Signed-off-by: Aaron Plattner <aplatt...@nvidia.com>
> ---
> Resend: forgot to Cc the list.

works, thanks.

Tested-by: Peter Hutterer <peter.hutte...@who-t.net>

Cheers,
   Peter

>  hw/xfree86/common/xf86AutoConfig.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hw/xfree86/common/xf86AutoConfig.c 
> b/hw/xfree86/common/xf86AutoConfig.c
> index a32c108ff2de..0f4f05de99e0 100644
> --- a/hw/xfree86/common/xf86AutoConfig.c
> +++ b/hw/xfree86/common/xf86AutoConfig.c
> @@ -412,7 +412,7 @@ autoConfigDevice(GDevPtr preconf_device)
>  
>              /* for each other driver found, copy the first screen, insert it
>               * into the list of screens and set the driver */
> -            while (i++ < md.nmatches) {
> +            for (i = 1; i < md.nmatches; i++) {
>                  if (!copyScreen(slp[0].screen, ptr, i, md.matches[i]))
>                      return NULL;
>              }
> -- 
> 2.12.2
> 
> 
_______________________________________________
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to