From: Matt Roper Date: Fri, 16 Oct 2015 22:11:24 +0000 (-0700) Subject: xf86drm: Handle unrecognized subsystems safely in drmGetDevice[s]() X-Git-Tag: android-x86-6.0-r1~172 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=ba5a6ecf81fc2e25a4c7b8c592143faadfdd63db;p=android-x86%2Fexternal-libdrm.git xf86drm: Handle unrecognized subsystems safely in drmGetDevice[s]() Both drmGetDevice() and drmGetDevices() currently print a warning when they encounter an unknown (non-PCI) subsystem type for a device node, but they still proceed to assume that the drmDevicePtr was initialized and try to add it to the local device array. Add a 'continue' to the error case handling to bypass the rest of the processing for devices we can't handle. Signed-off-by: Matt Roper Reviewed-by: Alex Deucher Reviewed-by: Emil Velikov --- diff --git a/xf86drm.c b/xf86drm.c index 951edbb7..7e28b4f7 100644 --- a/xf86drm.c +++ b/xf86drm.c @@ -3140,7 +3140,7 @@ int drmGetDevice(int fd, drmDevicePtr *device) break; default: fprintf(stderr, "The subsystem type is not supported yet\n"); - break; + continue; } if (i >= max_count) { @@ -3244,7 +3244,7 @@ int drmGetDevices(drmDevicePtr devices[], int max_devices) break; default: fprintf(stderr, "The subsystem type is not supported yet\n"); - break; + continue; } if (i >= max_count) {