[Bug,100077] libdrm atomic_add_unless() may reverse return value meaning
diff mbox

Message ID bug-100077-502@http.bugs.freedesktop.org/
State New
Headers show

Commit Message

bugzilla-daemon@freedesktop.org March 6, 2017, 8:41 a.m. UTC

            Bug ID: 100077
           Summary: libdrm atomic_add_unless() may reverse return value
           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

A one line (character) fix is of the form:

You are the assignee for the bug.


bugzilla-daemon@freedesktop.org Sept. 24, 2019, 5:09 p.m. UTC | #1

GitLab Migration User <gitlab-migration@fdo.invalid> changed:

           What    |Removed                     |Added
             Status|NEW                         |RESOLVED
         Resolution|---                         |MOVED

--- Comment #1 from GitLab Migration User <gitlab-migration@fdo.invalid> ---
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been
closed from further activity.

You can subscribe and participate further through the new bug through this link
to our GitLab instance: https://gitlab.freedesktop.org/mesa/drm/issues/17.

diff mbox

--- 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: