From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marcin Slusarz Subject: [PATCH] drm mode: fix drmIoctl wrapper Date: Sun, 5 Jun 2011 19:28:20 +0200 Message-ID: <20110605172820.GA26695@joi.lan> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail-bw0-f49.google.com (mail-bw0-f49.google.com [209.85.214.49]) by gabe.freedesktop.org (Postfix) with ESMTP id A94289E7C6 for ; Sun, 5 Jun 2011 10:28:24 -0700 (PDT) Received: by bwz1 with SMTP id 1so4038800bwz.36 for ; Sun, 05 Jun 2011 10:28:23 -0700 (PDT) Content-Disposition: inline List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dri-devel-bounces+sf-dri-devel=m.gmane.org@lists.freedesktop.org Errors-To: dri-devel-bounces+sf-dri-devel=m.gmane.org@lists.freedesktop.org To: dri-devel@lists.freedesktop.org List-Id: dri-devel@lists.freedesktop.org Both drmIoctl and ioctl define second argument as unigned long, but DRM_IOCTL do not. Debugging/tracing tools (like strace or valgrind) on 64-bit machines see different request value for ioctls with 32nd bit set, because casting signed int to unsigned long extends 32nd bit to upper word, so 0x80000000 becomes 0xFFFFFFFF80000000) Nobody noticed because higher 32 bits are chopped off on their way to kernel. --- xf86drmMode.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/xf86drmMode.c b/xf86drmMode.c index 0d268fc..f08e648 100644 --- a/xf86drmMode.c +++ b/xf86drmMode.c @@ -52,7 +52,7 @@ #define U642VOID(x) ((void *)(unsigned long)(x)) #define VOID2U64(x) ((uint64_t)(unsigned long)(x)) -static inline DRM_IOCTL(int fd, int cmd, void *arg) +static inline int DRM_IOCTL(int fd, unsigned long cmd, void *arg) { int ret = drmIoctl(fd, cmd, arg); return ret < 0 ? -errno : ret; -- 1.7.4.1