From patchwork Mon Mar 6 08:41:32 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: bugzilla-daemon@freedesktop.org X-Patchwork-Id: 9605251 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 BB319602B4 for ; Mon, 6 Mar 2017 08:41:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9C5BC27D5D for ; Mon, 6 Mar 2017 08:41:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9005527F81; Mon, 6 Mar 2017 08:41:35 +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.2 required=2.0 tests=BAYES_00,HTML_MESSAGE, RCVD_IN_DNSWL_MED 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 19CD027D5D for ; Mon, 6 Mar 2017 08:41:35 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 740F96E3CE; Mon, 6 Mar 2017 08:41:34 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from culpepper.freedesktop.org (culpepper.freedesktop.org [IPv6:2610:10:20:722:a800:ff:fe98:4b55]) by gabe.freedesktop.org (Postfix) with ESMTP id 8EE496E3CE for ; Mon, 6 Mar 2017 08:41:32 +0000 (UTC) Received: by culpepper.freedesktop.org (Postfix, from userid 33) id 87CF172169; Mon, 6 Mar 2017 08:41:32 +0000 (UTC) From: bugzilla-daemon@freedesktop.org To: dri-devel@lists.freedesktop.org Subject: [Bug 100077] libdrm atomic_add_unless() may reverse return value meaning Date: Mon, 06 Mar 2017 08:41:32 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: DRI X-Bugzilla-Component: libdrm X-Bugzilla-Version: unspecified X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: davshao@gmail.com X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: medium X-Bugzilla-Assigned-To: dri-devel@lists.freedesktop.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter Message-ID: X-Bugzilla-URL: http://bugs.freedesktop.org/ Auto-Submitted: auto-generated MIME-Version: 1.0 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: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP https://bugs.freedesktop.org/show_bug.cgi?id=100077 Bug ID: 100077 Summary: libdrm atomic_add_unless() may reverse return value meaning Product: DRI Version: unspecified Hardware: x86-64 (AMD64) OS: BSD (Others) Status: NEW Severity: normal Priority: medium Component: libdrm Assignee: dri-devel@lists.freedesktop.org Reporter: davshao@gmail.com atomic_add_unless() in libdrm xf86atomic.h may reverse the meaning of its return value. Linux kernel documentation seems to indicate something like: "Returns non-zero if @v was not @u, and zero otherwise." A simple inverting the meaning of libdrm's return value allowed glxgears to properly function for a hacked version of pkgsrc on DragonFly 4.7-DEVELOPMENT on an Intel IvyBridge integrated graphics machine. glxgears was already properly functioning on the same machine for NetBSD current, NetBSD using its own atomic operations declared in its sys/atomic.h header. A one line (character) fix is of the form: You are the assignee for the bug. --- xf86atomic.h.orig 2015-09-22 04:34:51.000000000 +0000 +++ xf86atomic.h @@ -111,7 +111,7 @@ static inline int atomic_add_unless(atom c = atomic_read(v); while (c != unless && (old = atomic_cmpxchg(v, c, c + add)) != c) c = old; - return c == unless; + return c != unless; } -- You are receiving this mail because: