Subject: kern/22474: [dM] physio code/comment mismatch
To: None <gnats-bugs@gnats.netbsd.org>
From: der Mouse <mouse@Rodents.Montreal.QC.CA>
List: netbsd-bugs
Date: 08/14/2003 03:05:11
>Number:         22474
>Category:       kern
>Synopsis:       physio() code and comments disagree
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    kern-bug-people
>State:          open
>Class:          doc-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Aug 14 07:06:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     der Mouse
>Release:        kern_physio.c,v 1.57 2003/08/07
>Organization:
	Dis-
>Environment:
	Any

>Description:
	Excerpted from kern_physio.c:

			/*
			 * Note that the raise/wait/lower/get error
			 * steps below would be done by biowait(), but
			 * we want to unlock the address space before
			 * we lower the priority.
			 *
			 * [raise the priority level to splbio]
			 */
			s = splbio();
	[...]
			/* [lower the priority level] */
			splx(s);

			/*
			 * [unlock the part of the address space previously
			 *    locked]
			 */
			vunmapbuf(bp, todo);
			uvm_vsunlock(p, bp->b_data, todo);

	Either the splx(s) needs to move down after the address space
	diddling or the comment (the one at the top of the stuff I
	quoted) needs to be fixed, it seems to me.  It might be good to
	think about how correct this stuff is; "when the code and the
	comments disagree, both are probably wrong".  (K&P, I think.)
>How-To-Repeat:
	Inspect kern_physio.c.
	Notice that the comment doesn't match the code.
>Fix:
	Either move the splx(s) or change the comment.  I don't
	consider myself comptent to say which is right; if I were
	pressed for a guess, I'd guess that the code is correct.

	If the code is wrong, this should be classed as sw-bug and
	probably medium or critical, rather than doc-bug and low.

/~\ The ASCII				der Mouse
\ / Ribbon Campaign
 X  Against HTML	       mouse@rodents.montreal.qc.ca
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B
>Release-Note:
>Audit-Trail:
>Unformatted: