diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2014-12-23 22:26:55 +0000 |
---|---|---|
committer | Michael Tokarev <mjt@tls.msk.ru> | 2015-01-15 10:44:13 +0300 |
commit | 90d6a6730b4dbe7d0ada9900aba8263d61376812 (patch) | |
tree | 99985a5fd6182dc2a5a36ed388f30db6b7fd1b94 /migration | |
parent | 2d8ac5eb7a7e72e0877cca2b3705eebeaf5526e7 (diff) | |
download | qemu-90d6a6730b4dbe7d0ada9900aba8263d61376812.zip qemu-90d6a6730b4dbe7d0ada9900aba8263d61376812.tar.gz qemu-90d6a6730b4dbe7d0ada9900aba8263d61376812.tar.bz2 |
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 <peter.maydell@linaro.org>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Diffstat (limited to 'migration')
-rw-r--r-- | migration/qemu-file.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/migration/qemu-file.c b/migration/qemu-file.c index d2d4007..a7f2a34 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); |