summaryrefslogtreecommitdiff
path: root/sys/dev/ic
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2020-06-29 15:01:59 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2020-06-29 15:01:59 +0000
commit8d901a7a2d8828af673ba5fe8c23c2f4e2350706 (patch)
tree0298b17e1d5454255903a033bab3fb640884d719 /sys/dev/ic
parent0b01d91de62bc3724947ec85a5febd9dcfa87e1b (diff)
Don't create sd(4) devices for nvme(4) namespaces that are
configured but have a size of 0. Should eliminate the 31 bogus sd(4) devices reported by Janne Johansson (occasionally known as jj@) on some Micron SSD's that passed through his hands. Doesn't break my nvme SSD's, nor jca@'s. ok deraadt@
Diffstat (limited to 'sys/dev/ic')
-rw-r--r--sys/dev/ic/nvme.c19
1 files changed, 7 insertions, 12 deletions
diff --git a/sys/dev/ic/nvme.c b/sys/dev/ic/nvme.c
index 43784dabc3f..3f18cb2037a 100644
--- a/sys/dev/ic/nvme.c
+++ b/sys/dev/ic/nvme.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nvme.c,v 1.76 2020/06/27 14:29:45 krw Exp $ */
+/* $OpenBSD: nvme.c,v 1.77 2020/06/29 15:01:58 krw Exp $ */
/*
* Copyright (c) 2014 David Gwynne <dlg@openbsd.org>
@@ -463,19 +463,14 @@ nvme_scsi_probe(struct scsi_link *link)
scsi_io_put(&sc->sc_iopool, ccb);
- if (rv != 0) {
- rv = EIO;
- goto done;
+ identify = NVME_DMA_KVA(mem);
+ if (rv == 0 && lemtoh64(&identify->nsze) > 0) {
+ /* Commit namespace if it has a size greater than zero. */
+ identify = malloc(sizeof(*identify), M_DEVBUF, M_WAITOK);
+ memcpy(identify, NVME_DMA_KVA(mem), sizeof(*identify));
+ sc->sc_namespaces[link->target].ident = identify;
}
- /* commit */
-
- identify = malloc(sizeof(*identify), M_DEVBUF, M_WAITOK|M_ZERO);
- memcpy(identify, NVME_DMA_KVA(mem), sizeof(*identify));
-
- sc->sc_namespaces[link->target].ident = identify;
-
-done:
nvme_dmamem_free(sc, mem);
return (rv);