NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

kern/48999: [drm] Incorrect return value from test_and_set_bit



>Number:         48999
>Category:       kern
>Synopsis:       [drm] Incorrect return value from test_and_set_bit
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Jul 15 23:00: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:



Home | Main Index | Thread Index | Old Index