[PATCH libdrm] xd86drm: read more than 128 bytes of uevent in drmParsePciBusInfo

Emil Velikov emil.l.velikov at gmail.com
Fri Nov 11 19:04:11 UTC 2016


From: Emil Velikov <emil.velikov at collabora.com>

Some platforms (such as Macs using OF) can have more information in the
uevent file thus reading only the first 128 might not be sufficient.

Bump it to 512, which "should be enough for everybody" ;-)

Cc: Mingcong Bai <jeffbai at aosc.xyz>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98629
Signed-off-by: Emil Velikov <emil.velikov at collabora.com>
---
Mingcong Bai, this should fix things but you'll need to apply it
on top of your libdrm package. There's no need to rebuild mesa
afterwords.

Note to self:
Strictly speaking we can rework drmGetDevice[s] to use [just] uevent...
---
 xf86drm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xf86drm.c b/xf86drm.c
index 676effc..80e2f27 100644
--- a/xf86drm.c
+++ b/xf86drm.c
@@ -2871,7 +2871,7 @@ static int drmParsePciBusInfo(int maj, int min, drmPciBusInfoPtr info)
 {
 #ifdef __linux__
     char path[PATH_MAX + 1];
-    char data[128 + 1];
+    char data[512 + 1];
     char *str;
     int domain, bus, dev, func;
     int fd, ret;
@@ -2882,7 +2882,7 @@ static int drmParsePciBusInfo(int maj, int min, drmPciBusInfoPtr info)
         return -errno;
 
     ret = read(fd, data, sizeof(data));
-    data[128] = '\0';
+    data[512] = '\0';
     close(fd);
     if (ret < 0)
         return -errno;
-- 
2.10.2



More information about the dri-devel mailing list