On 27.10.20 11:49, Klaus Jensen wrote: > From: Klaus Jensen <k.jen...@samsung.com> > > This adds support for multiple namespaces by introducing a new 'nvme-ns' > device model. The nvme device creates a bus named from the device name > ('id'). The nvme-ns devices then connect to this and registers > themselves with the nvme device. > > This changes how an nvme device is created. Example with two namespaces: > > -drive file=nvme0n1.img,if=none,id=disk1 > -drive file=nvme0n2.img,if=none,id=disk2 > -device nvme,serial=deadbeef,id=nvme0 > -device nvme-ns,drive=disk1,bus=nvme0,nsid=1 > -device nvme-ns,drive=disk2,bus=nvme0,nsid=2 > > The drive property is kept on the nvme device to keep the change > backward compatible, but the property is now optional. Specifying a > drive for the nvme device will always create the namespace with nsid 1. > > Signed-off-by: Klaus Jensen <k.jen...@samsung.com> > Reviewed-by: Keith Busch <kbu...@kernel.org> > Reviewed-by: Minwoo Im <minwoo.im....@gmail.com> > --- > hw/block/nvme-ns.h | 74 +++++++++++++ > hw/block/nvme.h | 46 ++++---- > hw/block/nvme-ns.c | 167 ++++++++++++++++++++++++++++ > hw/block/nvme.c | 249 +++++++++++++++++++++++++++--------------- > hw/block/meson.build | 2 +- > hw/block/trace-events | 6 +- > 6 files changed, 428 insertions(+), 116 deletions(-) > create mode 100644 hw/block/nvme-ns.h > create mode 100644 hw/block/nvme-ns.c
Hi, Coverity reports that nvme_exit() still contains a g_free(n->namespaces); call, which becomes wrong with this commit (because @namespaces is now an array). (This leads to qemu crashing when deleting an NVMe device.) Max