summaryrefslogtreecommitdiffstats
path: root/hw/block
diff options
context:
space:
mode:
authorMinwoo Im2021-02-05 18:03:20 +0100
committerKlaus Jensen2021-03-09 11:00:58 +0100
commit5215e60600b0bc0a011f4456e0f0a0d9376d9133 (patch)
treef2f0cb54930d1704fa77a7cc9fd8067b2413a23d /hw/block
parenthw/block/nvme: support namespace detach (diff)
downloadqemu-5215e60600b0bc0a011f4456e0f0a0d9376d9133.tar.gz
qemu-5215e60600b0bc0a011f4456e0f0a0d9376d9133.tar.xz
qemu-5215e60600b0bc0a011f4456e0f0a0d9376d9133.zip
hw/block/nvme: fix namespaces array to 1-based
subsys->namespaces array used to be sized to NVME_SUBSYS_MAX_NAMESPACES. But subsys->namespaces are being accessed with 1-based namespace id which means the very first array entry will always be empty(NULL). Signed-off-by: Minwoo Im <minwoo.im.dev@gmail.com> Reviewed-by: Keith Busch <kbusch@kernel.org> Reviewed-by: Klaus Jensen <k.jensen@samsung.com> Tested-by: Klaus Jensen <k.jensen@samsung.com> Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
Diffstat (limited to 'hw/block')
-rw-r--r--hw/block/nvme-subsys.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/hw/block/nvme-subsys.h b/hw/block/nvme-subsys.h
index 507efcd23f..20d34004c6 100644
--- a/hw/block/nvme-subsys.h
+++ b/hw/block/nvme-subsys.h
@@ -24,7 +24,7 @@ typedef struct NvmeSubsystem {
NvmeCtrl *ctrls[NVME_SUBSYS_MAX_CTRLS];
/* Allocated namespaces for this subsystem */
- NvmeNamespace *namespaces[NVME_SUBSYS_MAX_NAMESPACES];
+ NvmeNamespace *namespaces[NVME_SUBSYS_MAX_NAMESPACES + 1];
struct {
char *nqn;