diff options
-rw-r--r-- | hw/block/nvme-subsys.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/hw/block/nvme-subsys.h b/hw/block/nvme-subsys.h index 1cbcad9be2..7d7ef5f7f1 100644 --- a/hw/block/nvme-subsys.h +++ b/hw/block/nvme-subsys.h @@ -36,7 +36,7 @@ int nvme_subsys_register_ctrl(NvmeCtrl *n, Error **errp); static inline NvmeCtrl *nvme_subsys_ctrl(NvmeSubsystem *subsys, uint32_t cntlid) { - if (!subsys) { + if (!subsys || cntlid >= NVME_SUBSYS_MAX_CTRLS) { return NULL; } |