Skip to contentSkip to conversation

loadvm not working

Qemu-devel Piotras 2 participants 2 messages Sep 25, 2008

lore
Share & tools
lore

Piotras

author
#0 lore raw

Hi,

I discovered a bug that prevents loadvm from working correctly in current repository version (related to warning "qemu: warning:
instance 0 of device '' not present in current VM").

The implementation of functions qemu_get_be16 and qemu_get_be32 (in file vl.c) relies on implicit conversion of signed byte (int8_t) values returned by qemu_get_byte to multi-byte integer types. When value to be converted is negative, the result is incorrect.

There are two fixes possible:

1) change return type of qemu_get_byte to unsigned (uint8_t)

2) add explicit casts in qemu_get_be16 and qemu_get_be32

For consistency with qemu_get_be16 and qemu_get_be32, first solution looks better. However I didn't examine all other calls to qemu_get_byte for possible problems.

Hope this helps,

Piotr

#1 lore raw
Quoted 13 lines · Piotras

Hi,

I discovered a bug that prevents loadvm from working correctly in current repository version (related to warning "qemu: warning:
instance 0 of device '' not present in current VM"). The implementation of functions qemu_get_be16 and qemu_get_be32 (in file vl.c) relies on implicit conversion of signed byte (int8_t) values returned by qemu_get_byte to multi-byte integer types. When value to be converted is negative, the result is incorrect.

There are two fixes possible:

Quoted 8 lines

1) change return type of qemu_get_byte to unsigned (uint8_t)

2) add explicit casts in qemu_get_be16 and qemu_get_be32

For consistency with qemu_get_be16 and qemu_get_be32, first solution looks better. However I didn't examine all other calls to qemu_get_byte for possible problems.

Heh, I literally just debugged this myself :-) That patch that introduced this is being reverted so it'll be fixed in a few hours.

Regards,

Anthony Liguori

Quoted 6 lines

Hope this helps,

Piotr