[PATCH xserver] xfree86: fix autoConfigDevice() regression that skipped all but the first driver match

Eric Anholt eric at anholt.net
Wed May 10 00:37:56 UTC 2017


Aaron Plattner <aplattner at nvidia.com> writes:

> On 05/09/2017 04:51 PM, Eric Anholt wrote:
>> Aaron Plattner <aplattner at nvidia.com> writes:
>> 
>>> 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 <michel at daenzer.net>
>>> Reported-by: Peter Hutterer <peter.hutterer at who-t.net>
>>> Reported-by: Eric Anholt <eric at anholt.net>
>>> Cc: Adam Jackson <ajax at redhat.com>
>>> Fixes: 112d0d7d01b9 ("xfree86: Improved autoconfig drivers matching")
>>> Signed-off-by: Aaron Plattner <aplattner at nvidia.com>
>>> ---
>>> Resend: forgot to Cc the list.
>> 
>> This is a pretty clear unintended behavior change.
>> 
>> Tested-by: Eric Anholt <eric at anholt.net>
>> 
>> Since we collided on me pushing the revert, shall I squash this into a
>> re-cherry-pick of the change as a v2?
>
> Sounds good to me.

Done.  Thanks for the fix!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <https://lists.x.org/archives/xorg-devel/attachments/20170509/89593d35/attachment.sig>


More information about the xorg-devel mailing list