mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2025-01-01 00:18:15 +01:00
Fixed the sector size frobbing in sd_strategy() at least not to
break for the usual sector size. dscheck() adjusts b_bcount to handle EOF, so we must scale it and not preserve it. i/o beyond the end of partitions has been broken since rev.1.96. Not fixed in: od driver
This commit is contained in:
parent
d826c47904
commit
37b4744c2a
@ -15,7 +15,7 @@
|
||||
*
|
||||
* Ported to run under 386BSD by Julian Elischer (julian@dialix.oz.au) Sept 1992
|
||||
*
|
||||
* $Id: sd.c,v 1.112 1997/10/12 08:54:47 joerg Exp $
|
||||
* $Id: sd.c,v 1.113 1997/11/07 08:53:32 phk Exp $
|
||||
*/
|
||||
|
||||
#include "opt_bounce.h"
|
||||
@ -457,22 +457,21 @@ sd_strategy(struct buf *bp, struct scsi_link *sc_link)
|
||||
{
|
||||
int status;
|
||||
int sec_blk_ratio = secsize/DEV_BSIZE;
|
||||
/* save original block number and size */
|
||||
int b_blkno = bp->b_blkno;
|
||||
int b_bcount = bp->b_bcount;
|
||||
|
||||
/* replace with scaled values */
|
||||
/* Replace blkno and count with scaled values. */
|
||||
bp->b_blkno /= sec_blk_ratio;
|
||||
bp->b_bcount /= sec_blk_ratio;
|
||||
|
||||
/* enforce limits and map to physical block number */
|
||||
status = dscheck(bp, sd->dk_slices);
|
||||
|
||||
/* prevent bad side effects in block system */
|
||||
/*
|
||||
* Restore blkno and unscale the values set by dscheck(),
|
||||
* except for b_pblkno.
|
||||
*/
|
||||
bp->b_blkno = b_blkno;
|
||||
bp->b_bcount = b_bcount;
|
||||
|
||||
/* scale resid */
|
||||
bp->b_bcount *= sec_blk_ratio;
|
||||
bp->b_resid *= sec_blk_ratio;
|
||||
|
||||
/* see if the mapping failed */
|
||||
|
Loading…
Reference in New Issue
Block a user