mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-05 00:33:55 -06:00
migration/multifd: Stop changing the packet on recv side
As observed by Philippe, the multifd_ram_unfill_packet() function currently leaves the MultiFDPacket structure with mixed endianness. This is harmless, but ultimately not very clean. Stop touching the received packet and do the necessary work using stack variables instead. While here tweak the error strings and fix the space before semicolons. Also remove the "100 times bigger" comment because it's just one possible explanation for a size mismatch and it doesn't even match the code. CC: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Peter Xu <peterx@redhat.com> Signed-off-by: Fabiano Rosas <farosas@suse.de>
This commit is contained in:
parent
308d165c77
commit
81b0ed8ad8
2 changed files with 21 additions and 28 deletions
|
@ -230,22 +230,20 @@ void multifd_send_fill_packet(MultiFDSendParams *p)
|
|||
|
||||
static int multifd_recv_unfill_packet(MultiFDRecvParams *p, Error **errp)
|
||||
{
|
||||
MultiFDPacket_t *packet = p->packet;
|
||||
const MultiFDPacket_t *packet = p->packet;
|
||||
uint32_t magic = be32_to_cpu(packet->magic);
|
||||
uint32_t version = be32_to_cpu(packet->version);
|
||||
int ret = 0;
|
||||
|
||||
packet->magic = be32_to_cpu(packet->magic);
|
||||
if (packet->magic != MULTIFD_MAGIC) {
|
||||
error_setg(errp, "multifd: received packet "
|
||||
"magic %x and expected magic %x",
|
||||
packet->magic, MULTIFD_MAGIC);
|
||||
if (magic != MULTIFD_MAGIC) {
|
||||
error_setg(errp, "multifd: received packet magic %x, expected %x",
|
||||
magic, MULTIFD_MAGIC);
|
||||
return -1;
|
||||
}
|
||||
|
||||
packet->version = be32_to_cpu(packet->version);
|
||||
if (packet->version != MULTIFD_VERSION) {
|
||||
error_setg(errp, "multifd: received packet "
|
||||
"version %u and expected version %u",
|
||||
packet->version, MULTIFD_VERSION);
|
||||
if (version != MULTIFD_VERSION) {
|
||||
error_setg(errp, "multifd: received packet version %u, expected %u",
|
||||
version, MULTIFD_VERSION);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue