Subject: Re: kern/3963: flags is already B_READ or B_WRITE
To: None <netbsd-bugs@NetBSD.ORG>
From: Christos Zoulas <christos@nyc.deshaw.com>
List: netbsd-bugs
Date: 08/10/1997 15:58:00
In article <19970810135911.19224.qmail@mail.NetBSD.ORG> darrenr@NetBSD.ORG writes:
>
>>Number:         3963
>>Category:       kern
>>Synopsis:       duplicate evaluation
>>Confidential:   no
>>Severity:       non-critical
>>Priority:       low
>>Responsible:    kern-bug-people (Kernel Bug People)
>>State:          open
>>Class:          sw-bug
>>Submitter-Id:   net
>>Arrival-Date:   Sun Aug 10 07:05:00 1997
>>Last-Modified:
>>Originator:     Darren Reed
>>Organization:
>	Cybersource
>>Release:        NetBSD-1.2G
>>Environment:
>	
>NetBSD-current
>
>>Description:
>
>in physio(), flags is initialised thus:
>        flags &= B_READ | B_WRITE;
>
>and then used:
>                        if (!useracc(uio->uio_iov[i].iov_base,
>                                     uio->uio_iov[i].iov_len,
>                                     (flags == B_READ) ? B_WRITE : B_READ))
>This usage can become:
>                        if (!useracc(uio->uio_iov[i].iov_base,
>                                     uio->uio_iov[i].iov_len, flags))

Careful there... The ?: reverses the flags.

christos