Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/ic Don't attach an ld device if the format descripto...



details:   https://anonhg.NetBSD.org/src/rev/469b914c42ac
branches:  trunk
changeset: 459907:469b914c42ac
user:      mlelstv <mlelstv%NetBSD.org@localhost>
date:      Tue Oct 01 10:59:49 2019 +0000

description:
Don't attach an ld device if the format descriptor is unsupported/unused.

diffstat:

 sys/dev/ic/ld_nvme.c |  17 +++++++++++++++--
 1 files changed, 15 insertions(+), 2 deletions(-)

diffs (38 lines):

diff -r 1a463c277735 -r 469b914c42ac sys/dev/ic/ld_nvme.c
--- a/sys/dev/ic/ld_nvme.c      Tue Oct 01 10:52:53 2019 +0000
+++ b/sys/dev/ic/ld_nvme.c      Tue Oct 01 10:59:49 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ld_nvme.c,v 1.22 2019/04/26 14:28:40 mlelstv Exp $     */
+/*     $NetBSD: ld_nvme.c,v 1.23 2019/10/01 10:59:49 mlelstv Exp $     */
 
 /*-
  * Copyright (C) 2016 NONAKA Kimihiro <nonaka%netbsd.org@localhost>
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ld_nvme.c,v 1.22 2019/04/26 14:28:40 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ld_nvme.c,v 1.23 2019/10/01 10:59:49 mlelstv Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -105,6 +105,19 @@
        KASSERT(ns);
        f = &ns->ident->lbaf[NVME_ID_NS_FLBAS(ns->ident->flbas)];
 
+       /*
+        * NVME1.0e 6.11 Identify command
+        *
+        * LBADS values smaller than 9 are not supported, a value
+        * of zero means that the format is not used.
+        */
+       if (f->lbads < 9) {
+               if (f->lbads > 0)
+                       aprint_error_dev(self,
+                           "unsupported logical data size %u\n", f->lbads);
+               return;
+       }
+
        ld->sc_secsize = 1 << f->lbads;
        ld->sc_secperunit = ns->ident->nsze;
        ld->sc_maxxfer = naa->naa_maxphys;



Home | Main Index | Thread Index | Old Index