aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEmil Velikov2016-11-11 13:04:11 -0600
committerEmil Velikov2016-11-14 13:53:04 -0600
commitf53d3542c1dfa2a1c1a5a7155d058df9a6bcce7b (patch)
tree83cc8b930b586e94d5d249924e1376d319eba54a /xf86drm.c
parentde13ea387737cdc99ec43813acb4d4f443075db2 (diff)
downloadexternal-libdrm-f53d3542c1dfa2a1c1a5a7155d058df9a6bcce7b.tar.gz
external-libdrm-f53d3542c1dfa2a1c1a5a7155d058df9a6bcce7b.tar.xz
external-libdrm-f53d3542c1dfa2a1c1a5a7155d058df9a6bcce7b.zip
xd86drm: read more than 128 bytes of uevent in drmParsePciBusInfo
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" ;-) v2: Use sizeof(data)-1 over hardcoded number (Eric). Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98629 Signed-off-by: Emil Velikov <emil.velikov@collabora.com> Reported-by: Mingcong Bai <jeffbai@aosc.xyz> Tested-by: Mingcong Bai <jeffbai@aosc.xyz> (v1) Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Diffstat (limited to 'xf86drm.c')
-rw-r--r--xf86drm.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/xf86drm.c b/xf86drm.c
index 52add5e4..9b97bbb6 100644
--- a/xf86drm.c
+++ b/xf86drm.c
@@ -2864,7 +2864,7 @@ static int drmParsePciBusInfo(int maj, int min, drmPciBusInfoPtr info)
2864{ 2864{
2865#ifdef __linux__ 2865#ifdef __linux__
2866 char path[PATH_MAX + 1]; 2866 char path[PATH_MAX + 1];
2867 char data[128 + 1]; 2867 char data[512 + 1];
2868 char *str; 2868 char *str;
2869 int domain, bus, dev, func; 2869 int domain, bus, dev, func;
2870 int fd, ret; 2870 int fd, ret;
@@ -2875,7 +2875,7 @@ static int drmParsePciBusInfo(int maj, int min, drmPciBusInfoPtr info)
2875 return -errno; 2875 return -errno;
2876 2876
2877 ret = read(fd, data, sizeof(data)); 2877 ret = read(fd, data, sizeof(data));
2878 data[128] = '\0'; 2878 data[sizeof(data)-1] = '\0';
2879 close(fd); 2879 close(fd);
2880 if (ret < 0) 2880 if (ret < 0)
2881 return -errno; 2881 return -errno;