From 275ffb61d8ac14f0f24597f4b8ee9d78e74ac06d Mon Sep 17 00:00:00 2001 From: Martin Pieuchot Date: Wed, 19 Feb 2014 10:15:36 +0000 Subject: 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@ --- sys/scsi/sd.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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)) -- cgit v1.2.3