All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Anholt <eric@anholt.net>
To: dri-devel@lists.freedesktop.org
Cc: linux-kernel@vger.kernel.org, Rob Herring <robh@kernel.org>,
	Eric Anholt <eric@anholt.net>
Subject: [PATCH libdrm 1/2] Return an -ENODEV from drmGetDevice() when no device was found.
Date: Fri, 21 Oct 2016 10:12:39 -0700	[thread overview]
Message-ID: <20161021171240.6972-1-eric@anholt.net> (raw)

From: Rob Herring <robh@kernel.org>

Fixes crashes in Mesa on platform device, which expected *device to
have a device when 0 was returned.

(code from a paste by Rob, commit message by anholt)

Signed-off-by: Eric Anholt <eric@anholt.net>
---
 xf86drm.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/xf86drm.c b/xf86drm.c
index 9cfca49ddfda..9b52889e4cef 100644
--- a/xf86drm.c
+++ b/xf86drm.c
@@ -3181,6 +3181,8 @@ int drmGetDevice(int fd, drmDevicePtr *device)
 
     closedir(sysdir);
     free(local_devices);
+    if (*device == NULL)
+	return -ENODEV;
     return 0;
 
 free_devices:
-- 
2.9.3

             reply	other threads:[~2016-10-21 17:12 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-21 17:12 Eric Anholt [this message]
2016-10-21 17:12 ` [PATCH libdrm 2/2] Silence runtime complaints on platform devices Eric Anholt
2016-10-21 17:32   ` Alex Deucher
2016-10-21 17:32     ` Alex Deucher
2016-10-24 11:11   ` Emil Velikov
2016-10-24 11:11     ` Emil Velikov
2016-10-24 16:35     ` Eric Anholt
2016-10-24 16:35       ` Eric Anholt
2016-10-21 17:24 ` [PATCH libdrm 1/2] Return an -ENODEV from drmGetDevice() when no device was found Alex Deucher
2016-10-21 17:24   ` Alex Deucher
2016-10-21 17:31 ` Emil Velikov
2016-10-21 17:31   ` 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=20161021171240.6972-1-eric@anholt.net \
    --to=eric@anholt.net \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robh@kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.