diff options
author | Martin Pieuchot <mpi@cvs.openbsd.org> | 2014-02-19 10:15:36 +0000 |
---|---|---|
committer | Martin Pieuchot <mpi@cvs.openbsd.org> | 2014-02-19 10:15:36 +0000 |
commit | 275ffb61d8ac14f0f24597f4b8ee9d78e74ac06d (patch) | |
tree | b67b3cf26aadba6a25efbd6c232a909d5ac31b86 | |
parent | 26e7fe08fdfe574569e644a16a2c8aa7738b7cf0 (diff) |
If a disk returns a size of 0, treat it as an error to let the
driver re-probe for its capacity.
Allow to fully recognized Lexar JumpDrive S33 USB 3.0 sticks.
ok krw@, dlg@
-rw-r--r-- | sys/scsi/sd.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/sys/scsi/sd.c b/sys/scsi/sd.c index 2e93ed0b1a6..556c42dd21f 100644 --- a/sys/scsi/sd.c +++ b/sys/scsi/sd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sd.c,v 1.252 2014/02/13 05:51:06 halex Exp $ */ +/* $OpenBSD: sd.c,v 1.253 2014/02/19 10:15:35 mpi Exp $ */ /* $NetBSD: sd.c,v 1.111 1997/04/02 02:29:41 mycroft Exp $ */ /*- @@ -1439,6 +1439,11 @@ sd_read_cap_16(struct sd_softc *sc, int flags) scsi_xs_put(xs); if (rv == 0) { + if (_8btol(rdcap->addr) == 0) { + rv = EIO; + goto done; + } + sc->params.disksize = _8btol(rdcap->addr) + 1; sc->params.secsize = _4btol(rdcap->length); if (ISSET(_2btol(rdcap->lowest_aligned), READ_CAP_16_TPE)) |