aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorMinwoo Im <minwoo.im.dev@gmail.com>2021-02-06 02:03:20 +0900
committerKlaus Jensen <k.jensen@samsung.com>2021-03-09 11:00:58 +0100
commit5215e60600b0bc0a011f4456e0f0a0d9376d9133 (patch)
treef2f0cb54930d1704fa77a7cc9fd8067b2413a23d /hw
parent037953b5b299daec4d92253858de32c15dd4e9f4 (diff)
downloadqemu-5215e60600b0bc0a011f4456e0f0a0d9376d9133.zip
qemu-5215e60600b0bc0a011f4456e0f0a0d9376d9133.tar.gz
qemu-5215e60600b0bc0a011f4456e0f0a0d9376d9133.tar.bz2
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')
-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 507efcd..20d3400 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;