Module Name:    src
Committed By:   martin
Date:           Mon Oct 28 18:27:47 UTC 2019

Modified Files:
        src/sys/dev/ic [netbsd-8]: ld_nvme.c

Log Message:
Pull up following revision(s) (requested by mlelstv in ticket #1417):

        sys/dev/ic/ld_nvme.c: revision 1.23

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


To generate a diff of this commit:
cvs rdiff -u -r1.16.2.3 -r1.16.2.4 src/sys/dev/ic/ld_nvme.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/ic/ld_nvme.c
diff -u src/sys/dev/ic/ld_nvme.c:1.16.2.3 src/sys/dev/ic/ld_nvme.c:1.16.2.4
--- src/sys/dev/ic/ld_nvme.c:1.16.2.3	Thu Apr 19 15:37:56 2018
+++ src/sys/dev/ic/ld_nvme.c	Mon Oct 28 18:27:47 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: ld_nvme.c,v 1.16.2.3 2018/04/19 15:37:56 martin Exp $	*/
+/*	$NetBSD: ld_nvme.c,v 1.16.2.4 2019/10/28 18:27:47 martin Exp $	*/
 
 /*-
  * Copyright (C) 2016 NONAKA Kimihiro <non...@netbsd.org>
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ld_nvme.c,v 1.16.2.3 2018/04/19 15:37:56 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ld_nvme.c,v 1.16.2.4 2019/10/28 18:27:47 martin Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -105,6 +105,19 @@ ld_nvme_attach(device_t parent, device_t
 	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;

Reply via email to