[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 03/14] blockdev: Consistently use snapshot_node_name
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PULL 03/14] blockdev: Consistently use snapshot_node_name in external_snapshot_prepare() |
Date: |
Mon, 12 Nov 2018 18:05:52 +0100 |
From: Peter Maydell <address@hidden>
In the function external_snapshot_prepare() we have a
BlockdevSnapshotSync struct, which has the usual combination
of has_snapshot_node_name and snapshot_node_name fields for an
optional field. We set up a local variable
const char *snapshot_node_name =
s->has_snapshot_node_name ? s->snapshot_node_name : NULL;
and then mostly use "if (!snapshot_node_name)" for checking
whether we have a snapshot node name. The exception is that in
one place we check s->has_snapshot_node_name instead. This
confuses Coverity (CID 1396473), which thinks it might be
possible to get here with s->has_snapshot_node_name true but
snapshot_node_name NULL, and warns that the call to
qdict_put_str() will segfault in that case.
Make the code consistent and unconfuse Coverity by using
the same check for this conditional that we do in the rest
of the surrounding code.
Signed-off-by: Peter Maydell <address@hidden>
Reviewed-by: Alberto Garcia <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
blockdev.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/blockdev.c b/blockdev.c
index 9310ff3e7c..81f95d920b 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -1640,7 +1640,7 @@ static void external_snapshot_prepare(BlkActionState
*common,
}
options = qdict_new();
- if (s->has_snapshot_node_name) {
+ if (snapshot_node_name) {
qdict_put_str(options, "node-name", snapshot_node_name);
}
qdict_put_str(options, "driver", format);
--
2.19.1
- [Qemu-devel] [PULL 00/14] Block layer patches, Kevin Wolf, 2018/11/12
- [Qemu-devel] [PULL 01/14] file-posix: Use error API properly, Kevin Wolf, 2018/11/12
- [Qemu-devel] [PULL 03/14] blockdev: Consistently use snapshot_node_name in external_snapshot_prepare(),
Kevin Wolf <=
- [Qemu-devel] [PULL 02/14] blockdev: handle error on block latency histogram set error, Kevin Wolf, 2018/11/12
- [Qemu-devel] [PULL 04/14] nvme: don't unref ctrl_mem when device unrealized, Kevin Wolf, 2018/11/12
- [Qemu-devel] [PULL 05/14] nvme: free cmbuf in nvme_exit, Kevin Wolf, 2018/11/12
- [Qemu-devel] [PULL 06/14] file-posix: Skip effectiveless OFD lock operations, Kevin Wolf, 2018/11/12
- [Qemu-devel] [PULL 09/14] block: Make more block drivers compile-time configurable, Kevin Wolf, 2018/11/12
- [Qemu-devel] [PULL 13/14] block: Fix potential Null pointer dereferences in vvfat.c, Kevin Wolf, 2018/11/12
- [Qemu-devel] [PULL 10/14] job: Fix off-by-one assert checks for JobSTT and JobVerbTable, Kevin Wolf, 2018/11/12
- [Qemu-devel] [PULL 11/14] block: Null pointer dereference in blk_root_get_parent_desc(), Kevin Wolf, 2018/11/12
- [Qemu-devel] [PULL 14/14] qcow2: Read outside array bounds in qcow2_pre_write_overlap_check(), Kevin Wolf, 2018/11/12
- [Qemu-devel] [PULL 07/14] file-posix: Drop s->lock_fd, Kevin Wolf, 2018/11/12