From 3263b5a707c4d1a28503bb773a9feb27764e9bc1 Mon Sep 17 00:00:00 2001 From: Conghui Date: Wed, 14 Sep 2022 15:13:07 +0800 Subject: [PATCH] dm: virtio-blk: fix parameter err Fix the truncate issue for virtio block parameter. Tracked-On: #8162 Signed-off-by: Conghui --- devicemodel/hw/pci/virtio/virtio_block.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/devicemodel/hw/pci/virtio/virtio_block.c b/devicemodel/hw/pci/virtio/virtio_block.c index e499057ad..ea797ed84 100644 --- a/devicemodel/hw/pci/virtio/virtio_block.c +++ b/devicemodel/hw/pci/virtio/virtio_block.c @@ -506,7 +506,11 @@ virtio_blk_init(struct vmctx *ctx, struct pci_vdev *dev, char *opts) if (strcmp("iothread", opt) == 0) { use_iothread = true; } else { - opts_tmp = opts_start; + /* The string pointed by opts_start is truncated by strsep, + * so use opts instead of opts_start which point to the original + * parameter string. + * */ + opts_tmp = opts; } bctxt = blockif_open(opts_tmp, bident); if (bctxt == NULL) {