Subject: kern/3963: flags is already B_READ or B_WRITE
To: None <gnats-bugs@gnats.netbsd.org>
From: None <darrenr@NetBSD.ORG>
List: netbsd-bugs
Date: 08/10/1997 13:59:11
>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))
>How-To-Repeat:
	
>Fix:
see above.
>Audit-Trail:
>Unformatted: