From patchwork Tue Feb 10 00:10:43 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Vesely X-Patchwork-Id: 5804071 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id DB036BF6C3 for ; Tue, 10 Feb 2015 00:10:52 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0D82120125 for ; Tue, 10 Feb 2015 00:10:50 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id D822E20117 for ; Tue, 10 Feb 2015 00:10:48 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6BFE76E5EC; Mon, 9 Feb 2015 16:10:47 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-qa0-f51.google.com (mail-qa0-f51.google.com [209.85.216.51]) by gabe.freedesktop.org (Postfix) with ESMTP id 8D3976E5EC for ; Mon, 9 Feb 2015 16:10:45 -0800 (PST) Received: by mail-qa0-f51.google.com with SMTP id i13so5415030qae.10 for ; Mon, 09 Feb 2015 16:10:45 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references; bh=OvNB0q9wECkg4omI5mt8i8jw6Mnp1O1tks/JzPZahhw=; b=N6u08oupXidyVuzMl1/KSMpUqoeaAQ4Rfddx8Cj6F/1RESpIA+ZWRA1S/mS76Tbafo y55M9Mc1JmAADGti01f/m/lCgzGKf9MPrx2MU/dKT7uBg9kTOj3IXh1rr18q7vhYuYEI UJHSeG+yWUoHYK6kRfWOjhLdtyfW4aYGopxB8gli2uivAUHf8QctjsvGcH8bAgwPAlvo mOdtu/9MfvR/EUwYwEq1CXFHRjCptTE4APx+cePFAQVjb1pS883qmjhlxsmO0aCPX13u K/fjUCus0EYV6y6uNNy5/norpcaPxeNzMxO8djTROh8h1TjDGQISPjvuxWHynIpBFtjS 8cVw== X-Gm-Message-State: ALoCoQnPnxVN32KNDxIrHckjosrj1cjDcminDUE09AqiRdbRYV0l+JNzHSCglxVf93kVB0zM2wrM X-Received: by 10.140.42.83 with SMTP id b77mr40443323qga.43.1423527045129; Mon, 09 Feb 2015 16:10:45 -0800 (PST) Received: from adriatix.rutgers.edu ([198.151.130.142]) by mx.google.com with ESMTPSA id l6sm11834830qae.9.2015.02.09.16.10.44 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 09 Feb 2015 16:10:44 -0800 (PST) From: Jan Vesely To: dri-devel@lists.freedesktop.org, Ian Romanick , Emil Velikov Subject: [libdrm][PATCH 3/2] Fix always true comparison. Date: Mon, 9 Feb 2015 19:10:43 -0500 Message-Id: <1423527043-21264-1-git-send-email-jan.vesely@rutgers.edu> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1423517995-28251-1-git-send-email-jan.vesely@rutgers.edu> References: <1423517995-28251-1-git-send-email-jan.vesely@rutgers.edu> 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-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The only user I found is xserver, it can return -1 under certain conditions. So check for -1 explicitly. Signed-off-by: Jan Vesely --- I could not find whether it's actually legal to return encoded negative values in get_perm. This is a quick fix to detect the one case that I found. xf86drm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xf86drm.c b/xf86drm.c index fb673b5..8e54ac9 100644 --- a/xf86drm.c +++ b/xf86drm.c @@ -335,7 +335,7 @@ static int drmOpenDevice(dev_t dev, int minor, int type) drm_server_info->get_perms(&serv_group, &serv_mode); devmode = serv_mode ? serv_mode : DRM_DEV_MODE; devmode &= ~(S_IXUSR|S_IXGRP|S_IXOTH); - group = (serv_group >= 0) ? serv_group : DRM_DEV_GID; + group = (serv_group != ~0U) ? serv_group : DRM_DEV_GID; } #if !defined(UDEV)