summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmil Velikov <emil.velikov@collabora.com>2016-11-11 19:04:11 +0000
committerEmil Velikov <emil.l.velikov@gmail.com>2016-11-14 19:53:04 +0000
commitf53d3542c1dfa2a1c1a5a7155d058df9a6bcce7b (patch)
tree83cc8b930b586e94d5d249924e1376d319eba54a
parentde13ea387737cdc99ec43813acb4d4f443075db2 (diff)
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>
-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)
{
#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;
@@ -2875,7 +2875,7 @@ static int drmParsePciBusInfo(int maj, int min, drmPciBusInfoPtr info)
return -errno;
ret = read(fd, data, sizeof(data));
- data[128] = '\0';
+ data[sizeof(data)-1] = '\0';
close(fd);
if (ret < 0)
return -errno;