DF-1677 / fix.diff
diff --git a/sys/dev/disk/nvme/nvme.c b/sys/dev/disk/nvme/nvme.c --- a/sys/dev/disk/nvme/nvme.c +++ b/sys/dev/disk/nvme/nvme.c @@ -122,11 +122,15 @@ * Allocate submission and completion queues. If qid is 0 we are allocating * the ADMIN queues, otherwise we are allocating I/O queues. */ -int -nvme_alloc_subqueue(nvme_softc_t *sc, uint16_t qid) -{ - nvme_subqueue_t *queue = &sc->subqueues[qid]; - int error = 0; +int +nvme_alloc_subqueue(nvme_softc_t *sc, uint16_t qid) +{ + nvme_subqueue_t *queue; + int error = 0; + + if (qid >= NVME_MAX_QUEUES) + return EINVAL; + queue = &sc->subqueues[qid]; /* * For now implement the maximum queue size negotiated in the |