summary refs log tree commit diff stats
path: root/util/cache-utils.c
diff options
context:
space:
mode:
authorMichael S. Tsirkin <mst@redhat.com>2013-11-21 15:34:26 +0200
committerAnthony Liguori <aliguori@amazon.com>2013-11-21 07:55:10 -0800
commit376827d48922941d16ef9949672e86f820005d0a (patch)
tree6625a70db6873cd9a7aa8bac834f09df5add4876 /util/cache-utils.c
parentb15654c21acef4d2bc17e6ac528c6c93abbb7e1e (diff)
downloadfocaccia-qemu-376827d48922941d16ef9949672e86f820005d0a.tar.gz
focaccia-qemu-376827d48922941d16ef9949672e86f820005d0a.zip
s390x: fix flat file load on 32 bit systems
pc-bios/s390-zipl.rom is a flat image so it's expected that
loading it as elf will fail.
It should fall back on loading a flat file, but doesn't
on 32 bit systems, instead it fails printing:
    qemu: hardware error: could not load bootloader 's390-zipl.rom'

The result is boot failure.

The reason is that a 64 bit unsigned interger which is set
to -1 on error is compared to -1UL which on a 32 bit system
with gcc is a 32 bit unsigned interger.
Since both are unsigned, no sign extension takes place and
comparison evaluates to non-equal.

There's no reason to do clever tricks: all functions
we call actually return int so just use int.
And then we can use == -1 everywhere, consistently.

Reviewed-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Message-id: 20131121133426.GA30827@redhat.com
Signed-off-by: Anthony Liguori <aliguori@amazon.com>
Diffstat (limited to 'util/cache-utils.c')
0 files changed, 0 insertions, 0 deletions