mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 07:43:54 -06:00
migration: use parameters.mode in cpr_state_save
qmp_migrate guarantees that cpr_channel is not null for MIG_MODE_CPR_TRANSFER when cpr_state_save is called: qmp_migrate() if (s->parameters.mode == MIG_MODE_CPR_TRANSFER && !cpr_channel) { return; } cpr_state_save(cpr_channel) but cpr_state_save checks for mode differently before using channel, and Coverity cannot infer that they are equivalent in outgoing QEMU, and warns that channel may be NULL: cpr_state_save(channel) MigMode mode = migrate_mode(); if (mode == MIG_MODE_CPR_TRANSFER) { f = cpr_transfer_output(channel, errp); To make Coverity happy, assert that channel != NULL in cpr_state_save. Resolves: Coverity CID 1590980 Reported-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Steve Sistare <steven.sistare@oracle.com> Message-ID: <1738788841-211843-1-git-send-email-steven.sistare@oracle.com> [assert instead of using parameters.mode in cpr_state_save] Signed-off-by: Fabiano Rosas <farosas@suse.de>
This commit is contained in:
parent
24f4c80cfc
commit
b451705e3b
1 changed files with 1 additions and 0 deletions
|
@ -137,6 +137,7 @@ int cpr_state_save(MigrationChannel *channel, Error **errp)
|
|||
trace_cpr_state_save(MigMode_str(mode));
|
||||
|
||||
if (mode == MIG_MODE_CPR_TRANSFER) {
|
||||
g_assert(channel);
|
||||
f = cpr_transfer_output(channel, errp);
|
||||
} else {
|
||||
return 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue