summaryrefslogtreecommitdiff
path: root/sys/dev/ata/atascsi.c
diff options
context:
space:
mode:
authorChristopher Pascoe <pascoe@cvs.openbsd.org>2007-03-20 12:31:50 +0000
committerChristopher Pascoe <pascoe@cvs.openbsd.org>2007-03-20 12:31:50 +0000
commit57eac7ab6065d6c315fd31e809453e482cf1cf2d (patch)
tree75998e2996cede6f41c42bae68ca5e7496c20eb4 /sys/dev/ata/atascsi.c
parent45ba8af3a396979405c850de786e9480f952778a (diff)
Cap the device size we present to 2TB, just in case someone attaches
something really big. The SCSI layer isn't yet ready for it.
Diffstat (limited to 'sys/dev/ata/atascsi.c')
-rw-r--r--sys/dev/ata/atascsi.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/sys/dev/ata/atascsi.c b/sys/dev/ata/atascsi.c
index 19e655a9f4c..e6367d12938 100644
--- a/sys/dev/ata/atascsi.c
+++ b/sys/dev/ata/atascsi.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: atascsi.c,v 1.24 2007/03/20 12:24:02 pascoe Exp $ */
+/* $OpenBSD: atascsi.c,v 1.25 2007/03/20 12:31:49 pascoe Exp $ */
/*
* Copyright (c) 2007 David Gwynne <dlg@openbsd.org>
@@ -473,7 +473,7 @@ atascsi_disk_capacity_done(struct ata_xfer *xa)
struct scsi_xfer *xs = xa->atascsi_private;
struct ata_identify id;
struct scsi_read_cap_data rcd;
- u_int32_t capacity;
+ u_int64_t capacity;
int i;
switch (xa->state) {
@@ -492,6 +492,10 @@ atascsi_disk_capacity_done(struct ata_xfer *xa)
capacity += id.addrsec[0];
}
+ /* XXX SCSI layer can't handle a device this big yet */
+ if (capacity > 0xffffffff)
+ capacity = 0xffffffff;
+
_lto4b(capacity - 1, rcd.addr);
_lto4b(512, rcd.length);