All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH libdrm] xd86drm: read more than 128 bytes of uevent in drmParsePciBusInfo
@ 2016-11-11 19:04 Emil Velikov
  2016-11-14 11:11 ` Eric Engestrom
  0 siblings, 1 reply; 2+ messages in thread
From: Emil Velikov @ 2016-11-11 19:04 UTC (permalink / raw)
  To: dri-devel; +Cc: emil.l.velikov, Mingcong Bai

From: Emil Velikov <emil.velikov@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@aosc.xyz>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98629
Signed-off-by: Emil Velikov <emil.velikov@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

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH libdrm] xd86drm: read more than 128 bytes of uevent in drmParsePciBusInfo
  2016-11-11 19:04 [PATCH libdrm] xd86drm: read more than 128 bytes of uevent in drmParsePciBusInfo Emil Velikov
@ 2016-11-14 11:11 ` Eric Engestrom
  0 siblings, 0 replies; 2+ messages in thread
From: Eric Engestrom @ 2016-11-14 11:11 UTC (permalink / raw)
  To: Emil Velikov; +Cc: Mingcong Bai, dri-devel

On Friday, 2016-11-11 19:04:11 +0000, Emil Velikov wrote:
> From: Emil Velikov <emil.velikov@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@aosc.xyz>
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98629
> Signed-off-by: Emil Velikov <emil.velikov@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';

How about `sizeof(data)-1`?

Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>

>      close(fd);
>      if (ret < 0)
>          return -errno;
> -- 
> 2.10.2
> 
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-11-14 11:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-11 19:04 [PATCH libdrm] xd86drm: read more than 128 bytes of uevent in drmParsePciBusInfo Emil Velikov
2016-11-14 11:11 ` Eric Engestrom

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.