dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Eric Engestrom <eric.engestrom@imgtec.com>
To: Emil Velikov <emil.l.velikov@gmail.com>
Cc: Mingcong Bai <jeffbai@aosc.xyz>, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH libdrm] xd86drm: read more than 128 bytes of uevent in drmParsePciBusInfo
Date: Mon, 14 Nov 2016 11:11:50 +0000	[thread overview]
Message-ID: <20161114111150.GB1751@imgtec.com> (raw)
In-Reply-To: <20161111190411.19239-1-emil.l.velikov@gmail.com>

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

      reply	other threads:[~2016-11-14 11:11 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161114111150.GB1751@imgtec.com \
    --to=eric.engestrom@imgtec.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=emil.l.velikov@gmail.com \
    --cc=jeffbai@aosc.xyz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).