diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2018-11-01 16:30:37 +0000 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2018-11-12 17:46:57 +0100 |
commit | d52e1a0e967a532867149c2d95c2dd664ca22fe8 (patch) | |
tree | a2d1f5b434a4a6cc0ea230b6d8fd893f1e257c13 /hw/block | |
parent | 63d5341f8553ff78ae99407ff8ad5a6648b95a30 (diff) | |
download | qemu-d52e1a0e967a532867149c2d95c2dd664ca22fe8.zip qemu-d52e1a0e967a532867149c2d95c2dd664ca22fe8.tar.gz qemu-d52e1a0e967a532867149c2d95c2dd664ca22fe8.tar.bz2 |
blockdev: Consistently use snapshot_node_name in external_snapshot_prepare()
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 <peter.maydell@linaro.org>
Reviewed-by: Alberto Garcia <berto@igalia.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'hw/block')
0 files changed, 0 insertions, 0 deletions