summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2005-09-11 17:18:54 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2005-09-11 17:18:54 +0000
commitbe3f710a56e4630a4e815111fec121a52ba2896c (patch)
tree42e889de06d5a979ec22e62191f6c43a1f9666b1 /sys
parent6486a2c925348940190da3ed0559e67991930afb (diff)
Some UMASS devices blow up if MODE SENSE buffer length is 0 (aka 256).
Some blow up if buffer length is not 0. Just fake geometry for all UMASS devices since it's almost always fictitious anyway. One step on the road to eliminate geometry entirely. Fixes Ed Wandasiewicz's 2nd gen iPod mini and Sebastiaan Indesteege's UBest Technology device. ok marco@
Diffstat (limited to 'sys')
-rw-r--r--sys/scsi/sd.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/sys/scsi/sd.c b/sys/scsi/sd.c
index cea8569a3b1..fe339ef77ed 100644
--- a/sys/scsi/sd.c
+++ b/sys/scsi/sd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sd.c,v 1.91 2005/09/08 03:33:55 krw Exp $ */
+/* $OpenBSD: sd.c,v 1.92 2005/09/11 17:18:53 krw Exp $ */
/* $NetBSD: sd.c,v 1.111 1997/04/02 02:29:41 mycroft Exp $ */
/*-
@@ -1328,7 +1328,7 @@ sd_get_parms(sd, dp, flags)
struct disk_parms *dp;
int flags;
{
- struct scsi_mode_sense_buf *buf;
+ struct scsi_mode_sense_buf *buf = NULL;
struct page_rigid_geometry *rigid;
struct page_flex_geometry *flex;
struct page_reduced_geometry *reduced;
@@ -1337,7 +1337,15 @@ sd_get_parms(sd, dp, flags)
dp->disksize = scsi_size(sd->sc_link, flags, &ssblksize);
- buf = malloc(sizeof(*buf) ,M_TEMP, M_NOWAIT);
+ /*
+ * Many UMASS devices choke when asked about their geometry. Most
+ * don't have a meaningful geometry anyway, so just fake it if
+ * scsi_size() worked.
+ */
+ if ((sd->sc_link->flags & SDEV_UMASS) && (dp->disksize > 0))
+ goto validate; /* N.B. buf will be NULL at validate. */
+
+ buf = malloc(sizeof(*buf), M_TEMP, M_NOWAIT);
if (buf == NULL)
goto validate;