Subject: kern/32321: DEV_BSIZE/d_secsize confusion
To: None <kern-bug-people@netbsd.org, gnats-admin@netbsd.org,>
From: None <yamt@mwd.biglobe.ne.jp>
List: netbsd-bugs
Date: 12/17/2005 05:35:00
>Number:         32321
>Category:       kern
>Synopsis:       DEV_BSIZE/d_secsize confusion
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Dec 17 05:35:00 +0000 2005
>Originator:     YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
>Release:        NetBSD 3.99.13
>Organization:

>Environment:
	
	
System: NetBSD kaeru 3.99.13 NetBSD 3.99.13 (build.kaeru.xen.nodebug) #34: Mon Dec 12 14:52:57 JST 2005 takashi@kaeru:/home/takashi/work/kernel/build.kaeru.xen.nodebug i386
Architecture: i386
Machine: i386
>Description:

	1. bounds_check_with_label@sys/kern/subr_disk_mbr.c does
	  the following.  it seems incorrect as b_blkno is in DEV_BSIZE
	  and sz is in d_secsize.

		sz = howmany(bp->b_bcount, lp->d_secsize);

		if (bp->b_blkno + sz > p->p_size) {

	2. disklabel(8) seems to take them as in d_secsize and
	  complain "partition %c: partition extends past end of unit".

	  scsipi/{sd,cd}.c also seems to take p_offset as in d_secsize.

	  OTOH, dkwedge_bsdlabel seems to take p_offset and p_size
	  as in DEV_BSIZE.

>How-To-Repeat:
	code inspection.

>Fix:
	

>Unformatted: