The sd and od drivers didn't check for negative block numbers (like wd.c

does) before calling dscheck().  dscheck() doesn't appreciate this and
calls Debugger() and returns without setting bp->b_error.

This can happen when there is a casting error and offsets > 2G are
converted to negative off_t's in the disk tools.  (dumpfs used to do this).
This commit is contained in:
Peter Wemm 1996-08-02 06:10:49 +00:00
parent 8566830b43
commit 2176b02c56
2 changed files with 6 additions and 6 deletions

View File

@ -28,7 +28,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* $Id: od.c,v 1.18 1996/06/16 19:58:24 joerg Exp $
* $Id: od.c,v 1.19 1996/07/23 21:52:22 phk Exp $
*/
/*
@ -486,9 +486,9 @@ od_strategy(struct buf *bp, struct scsi_link *sc_link)
}
/*
* Odd number of bytes
* Odd number of bytes or negative offset
*/
if (bp->b_bcount % DEV_BSIZE != 0) {
if (bp->b_blkno < 0 || bp->b_bcount % DEV_BSIZE != 0) {
bp->b_error = EINVAL;
goto bad;
}

View File

@ -14,7 +14,7 @@
*
* Ported to run under 386BSD by Julian Elischer (julian@dialix.oz.au) Sept 1992
*
* $Id: sd.c,v 1.90 1996/06/14 11:02:20 asami Exp $
* $Id: sd.c,v 1.91 1996/07/23 21:52:27 phk Exp $
*/
#include "opt_bounce.h"
@ -430,9 +430,9 @@ sd_strategy(struct buf *bp, struct scsi_link *sc_link)
scsi_minphys(bp,&sd_switch);
/*
* Odd number of bytes
* Odd number of bytes or negative offset
*/
if (bp->b_bcount % DEV_BSIZE != 0) {
if (bp->b_blkno < 0 || bp->b_bcount % DEV_BSIZE != 0) {
bp->b_error = EINVAL;
goto bad;
}