NetBSD Problem Report #48999
From www@NetBSD.org Tue Jul 15 22:59:27 2014
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(Client CN "mail.netbsd.org", Issuer "Postmaster NetBSD.org" (verified OK))
by mollari.NetBSD.org (Postfix) with ESMTPS id 54DADA655A
for <gnats-bugs@gnats.NetBSD.org>; Tue, 15 Jul 2014 22:59:27 +0000 (UTC)
Message-Id: <20140715225925.B5748A655C@mollari.NetBSD.org>
Date: Tue, 15 Jul 2014 22:59:25 +0000 (UTC)
From: jmcneill@invisible.ca
Reply-To: jmcneill@invisible.ca
To: gnats-bugs@NetBSD.org
Subject: [drm] Incorrect return value from test_and_set_bit
X-Send-Pr-Version: www-1.0
>Number: 48999
>Category: kern
>Synopsis: [drm] Incorrect return value from test_and_set_bit
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: riastradh
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Tue Jul 15 23:00:00 +0000 2014
>Closed-Date: Sat Oct 04 15:52:08 +0000 2014
>Last-Modified: Sat Oct 04 15:55:00 +0000 2014
>Originator: Jared McNeill
>Release: HEAD
>Organization:
>Environment:
>Description:
Docs for test_and_set_bit [1] say:
> WARNING! It is incredibly important that the value be a boolean,
> ie. "0" or "1". Do not try to be fancy and save a few instructions by
> declaring the above to return "long" and just returning something like
> "old_val & mask" because that will not work.
But the implementation of this function in drm and drm2 both do "old_val & mask":
http://nxr.netbsd.org/xref/src/sys/external/bsd/drm/dist/bsd-core/drm_atomic.h#104
http://nxr.netbsd.org/xref/src/sys/external/bsd/drm2/include/linux/atomic.h#180
http://nxr.netbsd.org/xref/src/sys/external/bsd/drm2/include/linux/atomic.h#193
http://nxr.netbsd.org/xref/src/sys/external/bsd/drm2/include/linux/atomic.h#206
[1] https://www.kernel.org/doc/Documentation/atomic_ops.txt
>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: kern-bug-people->riastradh
Responsible-Changed-By: dholland@NetBSD.org
Responsible-Changed-When: Wed, 16 Jul 2014 01:23:28 +0000
Responsible-Changed-Why:
by request
State-Changed-From-To: open->closed
State-Changed-By: riastradh@NetBSD.org
State-Changed-When: Thu, 17 Jul 2014 14:32:31 +0000
State-Changed-Why:
fixed in rev. 1.7 of linux/atomic.h
From: "Taylor R Campbell" <riastradh@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/48999 CVS commit: src/sys/external/bsd/drm2/include/linux
Date: Thu, 17 Jul 2014 14:30:33 +0000
Module Name: src
Committed By: riastradh
Date: Thu Jul 17 14:30:33 UTC 2014
Modified Files:
src/sys/external/bsd/drm2/include/linux: atomic.h bitops.h
Log Message:
Correct return values of Linux test-and-set operations (PR 48999).
Linux's Documentation/atomic_ops.txt says in no uncertain terms these
must return 0 or 1, not zero or nonzero. I don't think this has
caused an issue for drm (yet), but better to have it right.
To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/external/bsd/drm2/include/linux/atomic.h
cvs rdiff -u -r1.5 -r1.6 src/sys/external/bsd/drm2/include/linux/bitops.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
State-Changed-From-To: closed->open
State-Changed-By: mrg@NetBSD.org
State-Changed-When: Fri, 18 Jul 2014 01:53:35 +0000
State-Changed-Why:
not fixed in drm yet.
State-Changed-From-To: open->closed
State-Changed-By: riastradh@NetBSD.org
State-Changed-When: Sat, 04 Oct 2014 15:52:08 +0000
State-Changed-Why:
fixed in rev. 1.5 of drm_atomic.h
From: "Taylor R Campbell" <riastradh@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/48999 CVS commit: src/sys/external/bsd/drm/dist/bsd-core
Date: Sat, 4 Oct 2014 15:51:23 +0000
Module Name: src
Committed By: riastradh
Date: Sat Oct 4 15:51:23 UTC 2014
Modified Files:
src/sys/external/bsd/drm/dist/bsd-core: drm_atomic.h
Log Message:
Canonicalize boolean result from test_and_set_bit.
Not actually semantically significant for any callers, but Linux
documentation insists it is important, so we'll follow suit.
Fixes last part of PR kern/48999.
To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/external/bsd/drm/dist/bsd-core/drm_atomic.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2014
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.