aboutsummaryrefslogtreecommitdiff
path: root/hw/block
diff options
context:
space:
mode:
Diffstat (limited to 'hw/block')
-rw-r--r--hw/block/nvme-subsys.h4
1 files changed, 1 insertions, 3 deletions
diff --git a/hw/block/nvme-subsys.h b/hw/block/nvme-subsys.h
index 24132edd00..1cbcad9be2 100644
--- a/hw/block/nvme-subsys.h
+++ b/hw/block/nvme-subsys.h
@@ -49,12 +49,10 @@ static inline NvmeCtrl *nvme_subsys_ctrl(NvmeSubsystem *subsys,
static inline NvmeNamespace *nvme_subsys_ns(NvmeSubsystem *subsys,
uint32_t nsid)
{
- if (!subsys) {
+ if (!subsys || !nsid || nsid > NVME_MAX_NAMESPACES) {
return NULL;
}
- assert(nsid && nsid <= NVME_MAX_NAMESPACES);
-
return subsys->namespaces[nsid];
}