diff options
| author | andrew <andrew@NetBSD.org> | 1993-07-04 07:09:59 +0000 |
|---|---|---|
| committer | andrew <andrew@NetBSD.org> | 1993-07-04 07:09:59 +0000 |
| commit | 44b50138620ff5d3d2093eba56d709b28cfb7182 (patch) | |
| tree | 3df2119ba45edc564624e1b5834b060064fded1b /sys/dev | |
| parent | 12b46ebf295528630f144d5839d33d62faa436d6 (diff) | |
Reject non block-aligned transfers (where a block is 512 bytes in length);
they were causing scsi controller lockups. Replace an occurrence of "512"
with SECSIZE, which is #defined to be 512.
Diffstat (limited to 'sys/dev')
| -rw-r--r-- | sys/dev/scsipi/sd.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/sys/dev/scsipi/sd.c b/sys/dev/scsipi/sd.c index bfd10164778..ea494e0445f 100644 --- a/sys/dev/scsipi/sd.c +++ b/sys/dev/scsipi/sd.c @@ -13,7 +13,7 @@ * on the understanding that TFS is not responsible for the correct * functioning of this software in any circumstances. * - * $Id: sd.c,v 1.15 1993/06/27 06:59:20 andrew Exp $ + * $Id: sd.c,v 1.16 1993/07/04 07:09:59 andrew Exp $ */ #include "sd.h" @@ -367,6 +367,12 @@ sdstrategy(struct buf *bp) printf("sd%d: %d bytes @ blk%d\n", unit, bp->b_bcount, bp->b_blkno); + /* Reject non block-aligned transfers */ + if (bp->b_bcount % SECSIZE) { + bp->b_error = EINVAL; + goto bad; + } + sdminphys(bp); /* If the device has been made invalid, error out */ @@ -750,7 +756,7 @@ sdgetdisklabel(u_char unit) sd->disklabel.d_partitions[RAW_PART].p_offset = 0; sd->disklabel.d_partitions[RAW_PART].p_size = sd->params.disksize; sd->disklabel.d_npartitions = MAXPARTITIONS; - sd->disklabel.d_secsize = 512; /* as long as it's not 0 */ + sd->disklabel.d_secsize = SECSIZE; /* as long as it's not 0 */ sd->disklabel.d_ntracks = sd->params.heads; sd->disklabel.d_nsectors = sd->params.sectors; sd->disklabel.d_ncylinders = sd->params.cyls; |
