summary refs log tree commit diff stats
path: root/qga/main.c
diff options
context:
space:
mode:
authorEric Blake <eblake@redhat.com>2020-03-20 10:05:07 -0500
committerMichael Roth <mdroth@linux.vnet.ibm.com>2020-03-24 11:32:19 -0500
commita23f38a72921fa915536a981a4f8a9134512f120 (patch)
treedcab1333de8db880f53282a2a089b731d485f202 /qga/main.c
parent807e2b6fce022707418bc8f61c069d91c613b3d2 (diff)
downloadfocaccia-qemu-a23f38a72921fa915536a981a4f8a9134512f120.tar.gz
focaccia-qemu-a23f38a72921fa915536a981a4f8a9134512f120.zip
qga: Fix undefined C behavior
The QAPI struct GuestFileWhence has a comment about how we are
exploiting equivalent values between two different integer types
shared in a union. But C says behavior is undefined on assignments to
overlapping storage when the two types are not the same width, and
indeed, 'int64_t value' and 'enum QGASeek name' are very likely to be
different in width.  Utilize a temporary variable to fix things.

Reported-by: Peter Maydell <peter.maydell@linaro.org>
Fixes: 0b4b49387
Fixes: Coverity CID 1421990
Signed-off-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Diffstat (limited to 'qga/main.c')
0 files changed, 0 insertions, 0 deletions