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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

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




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux