From: Peter Maydell Date: Tue, 23 Dec 2014 22:26:55 +0000 (+0000) Subject: migration/qemu-file.c: Don't shift left into sign bit X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=90d6a6730b4dbe7d0ada9900aba8263d61376812;p=qmiga%2Fqemu.git migration/qemu-file.c: Don't shift left into sign bit Add a cast in qemu_get_be32() to avoid shifting left into the sign bit of a signed integer (which is undefined behaviour in C). Signed-off-by: Peter Maydell Signed-off-by: Michael Tokarev --- diff --git a/migration/qemu-file.c b/migration/qemu-file.c index d2d40073f0..a7f2a34430 100644 --- a/migration/qemu-file.c +++ b/migration/qemu-file.c @@ -503,7 +503,7 @@ unsigned int qemu_get_be16(QEMUFile *f) unsigned int qemu_get_be32(QEMUFile *f) { unsigned int v; - v = qemu_get_byte(f) << 24; + v = (unsigned int)qemu_get_byte(f) << 24; v |= qemu_get_byte(f) << 16; v |= qemu_get_byte(f) << 8; v |= qemu_get_byte(f);