From patchwork Fri Nov 11 19:04:11 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emil Velikov X-Patchwork-Id: 9423525 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 790F760484 for ; Fri, 11 Nov 2016 19:14:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 62F3429AE4 for ; Fri, 11 Nov 2016 19:14:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5352429AF0; Fri, 11 Nov 2016 19:14:58 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 32A7B29AE4 for ; Fri, 11 Nov 2016 19:14:54 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8BEF66E122; Fri, 11 Nov 2016 19:14:53 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm0-x244.google.com (mail-wm0-x244.google.com [IPv6:2a00:1450:400c:c09::244]) by gabe.freedesktop.org (Postfix) with ESMTPS id C74246E122 for ; Fri, 11 Nov 2016 19:14:51 +0000 (UTC) Received: by mail-wm0-x244.google.com with SMTP id g23so11476182wme.1 for ; Fri, 11 Nov 2016 11:14:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=r20+Jg04BTsZZFlbjHip6Qrfxc8SLxv6uRkwWPa6BMI=; b=pTLmWKGVOAq89xLgDFiMr1xIvXGTqUoF8BI2vWtl4QDVy7UAL38ZjcMeYyS7JUYMQm Q7EwNaxK+J6snS3Kkw9QmU84kewcj+mt6obF1t/EjmvvO9hxiqUufgVqF4ZtjwXj5rgR RnJDdSSkId/9BS1ILp+azwYXWBLafiLE7lhYWC849ADpkg4uZG9tzh1GQkEwg+wtHnki On7dShVDSPBPdiuxRB7PqGUokBPKkd3Zclp4g+aO7ivLlM9r3NSvsPLvjS7TQjq9X00h uhR2zo4Eiz8tPBdN0MnFzT0jUEoidtTRyUXDpg8b3WO7SLy9wK3fKzlHwwi6dqABlVro 88lg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=r20+Jg04BTsZZFlbjHip6Qrfxc8SLxv6uRkwWPa6BMI=; b=EJCHQ0BFg3YR6+YvSeL/5aEZM4vxEwc01dvhKYKeCBI7mrUX7d8pLCNG/KkBGaUFMh 6vvjdtWuH/igU+866gWjDU0Lz9gtSMjerZEpj2AJCzRwmTiMf2kpHEYf9JWni6bVf/HJ zfvP6E4VsQXwPXJRgOZuAhAbXObkzpyZEkEXES00/Fz0izu4n651NPP+9cgInz/y8Z/Z R00EgCSrR7rB/pTwhmk+CbRkbPmyFyVm2XJpGXqTDZEk+B9DeE91R/RWsCpVDbM57eWr qMtHE/YSPVwth58fwU8hI2MMHysfTXqMGLMNnu09sauvJ4AikiRy6+CF3y3jrAofZqYO 5ECA== X-Gm-Message-State: ABUngvf1cKvhuR8wR3PVGCBhRZx0gBwdlHe1YrBSyWHPFdnLulsT1AYyENCBHReA9bcN8w== X-Received: by 10.28.167.139 with SMTP id q133mr34734032wme.15.1478891690344; Fri, 11 Nov 2016 11:14:50 -0800 (PST) Received: from arch-x1c3.cbg.collabora.co.uk ([2a00:1098:5:0:9665:9cff:feee:aa4d]) by smtp.gmail.com with ESMTPSA id f10sm12948570wjl.28.2016.11.11.11.14.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 11 Nov 2016 11:14:49 -0800 (PST) From: Emil Velikov To: dri-devel@lists.freedesktop.org Subject: [PATCH libdrm] xd86drm: read more than 128 bytes of uevent in drmParsePciBusInfo Date: Fri, 11 Nov 2016 19:04:11 +0000 Message-Id: <20161111190411.19239-1-emil.l.velikov@gmail.com> X-Mailer: git-send-email 2.10.2 Cc: emil.l.velikov@gmail.com, Mingcong Bai X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Emil Velikov 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 Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98629 Signed-off-by: Emil Velikov Reviewed-by: Eric Engestrom --- 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;