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 [thread overview]
Message-ID: <bug-100077-502@http.bugs.freedesktop.org/> (raw)
[-- Attachment #1.1: Type: text/plain, Size: 1560 bytes --]
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:
--- 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:
You are the assignee for the bug.
[-- Attachment #1.2: Type: text/html, Size: 2888 bytes --]
[-- Attachment #2: Type: text/plain, Size: 160 bytes --]
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
next reply other threads:[~2017-03-06 8:41 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-06 8:41 bugzilla-daemon [this message]
2017-03-16 0:08 ` [PATCH libdrm] atomic: fix atomic_add_unless() fallback's return value Eric Engestrom
2017-03-16 16:46 ` Eric Engestrom
2017-03-17 19:08 ` Emil Velikov
2019-09-24 17:09 ` [Bug 100077] libdrm atomic_add_unless() may reverse return value meaning bugzilla-daemon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=bug-100077-502@http.bugs.freedesktop.org/ \
--to=bugzilla-daemon@freedesktop.org \
--cc=dri-devel@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.