projects
/
qemu.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
2d8ac5e
)
migration/qemu-file.c: Don't shift left into sign bit
author
Peter Maydell
<peter.maydell@linaro.org>
Tue, 23 Dec 2014 22:26:55 +0000
(22:26 +0000)
committer
Michael Tokarev
<mjt@tls.msk.ru>
Thu, 15 Jan 2015 07:44:13 +0000
(10:44 +0300)
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>
migration/qemu-file.c
patch
|
blob
|
history
diff --git
a/migration/qemu-file.c
b/migration/qemu-file.c
index d2d40073f04f2edd6777c4b506b6b6eabef9b6e2..a7f2a344305ca3edc2bbf1d7e6e9f16ff5dbdd9e 100644
(file)
--- 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);