Subject: Re: Reading past device size (/dev/vnd v.s. /dev/cd)
To: None <reinoud@netbsd.org>
From: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
List: tech-kern
Date: 01/21/2006 00:24:25
> What puzzles me is that vnd and cd both use bounds_check_with_label(). The 
> only place in cd.c i found that changes b_bcount is when its marked as an 
> ANCIENT disc. Since its an ATAPI it can never be marked that way.

bounds_check_with_mediasize is used for raw partition.
yes, their behaviours are inconsistent.

> Any ideas? Should the KASSERT() in nestiobuf_iodone() be modified or should 
> it detect this truncation of its transfer and flag an error?

the KASSERT is "correct" as nestiobuf doesn't work if i/o is truncated.
to handle the condition, something similar to what kern_physio.c does
is necessary.
normally it isn't a problem because filesystems never try to read
beyond the end of media.  does udf really need to do it?

YAMAMOTO Takashi