From: Matt Roper <matthew.d.roper@intel.com>
To: dri-devel@lists.freedesktop.org
Cc: Emil Velikov <emil.l.velikov@gmail.com>
Subject: [PATCH libdrm 2/2] xf86drm: Handle unrecognized subsystems safely in drmGetDevice[s]()
Date: Fri, 16 Oct 2015 15:11:24 -0700 [thread overview]
Message-ID: <1445033484-21089-2-git-send-email-matthew.d.roper@intel.com> (raw)
In-Reply-To: <1445033484-21089-1-git-send-email-matthew.d.roper@intel.com>
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.
Cc: Emil Velikov <emil.l.velikov@gmail.com>
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
---
xf86drm.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/xf86drm.c b/xf86drm.c
index 951edbb..7e28b4f 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) {
--
2.1.4
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2015-10-16 22:12 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-16 22:11 [PATCH libdrm 1/2] xf86drm: Fix error handling for drmGetDevice() Matt Roper
2015-10-16 22:11 ` Matt Roper [this message]
2015-10-16 22:14 ` [PATCH libdrm 2/2] xf86drm: Handle unrecognized subsystems safely in drmGetDevice[s]() Alex Deucher
2015-10-16 22:27 ` Emil Velikov
2015-10-16 22:31 ` Matt Roper
2015-10-20 17:50 ` Emil Velikov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1445033484-21089-2-git-send-email-matthew.d.roper@intel.com \
--to=matthew.d.roper@intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=emil.l.velikov@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox