Revert "xf86drm: cap number of reported devices by drmGetDevice(2)"

This reverts commit 8cb12a2528.

The commit fixed the OOB, yet it broke drmDevices2(0, NULL, 0) - aka we
did not return the total devices list.

Reviewed-by: Simon Ser <contact@emersion.fr>
main
Emil Velikov 2021-02-11 21:38:31 +00:00
parent 632f59fcbf
commit 06844b6eae
1 changed files with 3 additions and 4 deletions

View File

@ -4263,13 +4263,12 @@ drm_public int drmGetDevices2(uint32_t flags, drmDevicePtr devices[],
if (!local_devices[i]) if (!local_devices[i])
continue; continue;
if ((devices != NULL) && (device_count < max_devices)) { if ((devices != NULL) && (device_count < max_devices))
devices[device_count] = local_devices[i]; devices[device_count] = local_devices[i];
device_count++; else
} else {
drmFreeDevice(&local_devices[i]); drmFreeDevice(&local_devices[i]);
}
device_count++;
} }
closedir(sysdir); closedir(sysdir);