qemu/hw
Laszlo Ersek 1b57bd4f2f loader: fix undefined behavior in rom_order_compare()
According to ISO C99 / N1256 (referenced in HACKING):

> 6.5.8 Relational operators
>
> 4 For the purposes of these operators, a pointer to an object that is
>   not an element of an array behaves the same as a pointer to the first
>   element of an array of length one with the type of the object as its
>   element type.
>
> 5 When two pointers are compared, the result depends on the relative
>   locations in the address space of the objects pointed to. If two
>   pointers to object or incomplete types both point to the same object,
>   or both point one past the last element of the same array object, they
>   compare equal. If the objects pointed to are members of the same
>   aggregate object, pointers to structure members declared later compare
>   greater than pointers to members declared earlier in the structure,
>   and pointers to array elements with larger subscript values compare
>   greater than pointers to elements of the same array with lower
>   subscript values. All pointers to members of the same union object
>   compare equal. If the expression /P/ points to an element of an array
>   object and the expression /Q/ points to the last element of the same
>   array object, the pointer expression /Q+1/ compares greater than /P/.
>   In all other cases, the behavior is undefined.

Our AddressSpace objects are allocated generally individually, and kept in
the "address_spaces" linked list, so we mustn't compare their addresses
with relops.

Convert the pointers subjected to the relop in rom_order_compare() to
"uintptr_t":

> 7.18.1.4 Integer types capable of holding object pointers
>
> 1 [...]
>
>   The following type designates an unsigned integer type with the
>   property that any valid pointer to void can be converted to this type,
>   then converted back to pointer to void, and the result will compare
>   equal to the original pointer:
>
>   /uintptr_t/
>
>   These types are optional.

Cc: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Alistair Francis <alistair.francis@xilinx.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Peter Maydell <peter.maydell@linaro.org>
Cc: qemu-devel@nongnu.org
Fixes: 3e76099aac
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Alistair Francis <alistair.francis@xilinx.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2016-11-30 04:22:18 +02:00
..
9pfs 9pfs: add cleanup operation for proxy backend driver 2016-11-23 13:53:34 +01:00
acpi nvdimm acpi: introduce NVDIMM_DSM_MEMORY_SIZE 2016-11-15 17:20:37 +02:00
adc STM32F2xx: Add the ADC device 2016-10-04 13:28:07 +01:00
alpha target-alpha: Fix interrupt mask for cpu1 2016-11-22 16:53:53 +01:00
arm loader: fix handling of custom address spaces when adding ROM blobs 2016-11-30 04:20:57 +02:00
audio migration/pcspk: Add a property to state if pcspk is migrated 2016-11-28 16:45:12 +01:00
block xen_disk: split discard input to match internal representation 2016-11-23 10:47:48 -08:00
bt char: replace avail_connections 2016-10-24 15:46:10 +02:00
char hw/char/spapr_vty: Return amount of free buffer entries in vty_can_receive() 2016-11-23 12:00:48 +11:00
core loader: fix undefined behavior in rom_order_compare() 2016-11-30 04:22:18 +02:00
cpu
cris cris: Fix broken header guard in hw/cris/boot.h 2016-07-12 16:20:46 +02:00
display Xen 2016/10/28 2016-10-31 12:35:39 +00:00
dma hw/dma/pl080: Fix bad bit mask (PL080_CONF_M1 | PL080_CONF_M1) 2016-10-17 19:22:17 +01:00
gpio i.MX: Fix GPIO ISR register write 2016-10-28 15:51:27 +01:00
i2c hw/i2c/bitbang_i2c: Handle NACKs from devices 2016-11-07 10:01:15 +00:00
i386 loader: fix handling of custom address spaces when adding ROM blobs 2016-11-30 04:20:57 +02:00
ide atapi: classify read_cd as conditionally returning data 2016-11-14 11:15:54 -05:00
input hw/input/hid: support alternative sysrq/break scancodes for gtk-vnc 2016-11-10 15:29:58 +00:00
intc nvic: set pending status for not active interrupts 2016-11-07 10:00:24 +00:00
ipack
ipmi ipmi: fix qemu crash while migrating with ipmi 2016-11-18 17:50:09 +02:00
isa char: remove init callback 2016-10-24 15:27:20 +02:00
lm32 loader: fix handling of custom address spaces when adding ROM blobs 2016-11-30 04:20:57 +02:00
m68k m68k: change default system clock for m5208evb 2016-10-08 11:25:29 +03:00
mem pc: memhp: enable nvdimm device hotplug 2016-11-01 19:21:09 +02:00
microblaze clean-up: removed duplicate #includes 2016-10-28 18:17:24 +03:00
mips clean-up: removed duplicate #includes 2016-10-28 18:17:24 +03:00
misc ivshmem: Fix 64 bit memory bar configuration 2016-11-18 17:29:34 +02:00
moxie
net virtio, vhost, pc, pci: documentation, fixes and cleanups 2016-11-15 19:50:36 +00:00
nvram fw_cfg: move FW_CFG_NB_CPUS out of fw_cfg_init1() 2016-11-16 12:09:58 -02:00
openrisc
pci trace-events: fix first line comment in trace-events 2016-08-12 10:36:01 +01:00
pci-bridge clean-up: removed duplicate #includes 2016-10-28 18:17:24 +03:00
pci-host ppc: Make uninorth interrupt swizzling identical to Grackle 2016-11-23 12:00:48 +11:00
pcmcia
ppc spapr: Fix 2.7<->2.8 migration of PCI host bridge 2016-11-23 12:00:48 +11:00
s390x virtio: allow per-device-class legacy features 2016-11-15 17:20:36 +02:00
scsi Small fixes for rc2. 2016-11-29 10:05:07 +00:00
sd vmstateify ssi-sd 2016-09-22 18:13:08 +01:00
sh4 sh4: fix broken link to documentation 2016-09-15 15:32:22 +03:00
smbios smbios: fix uuid copy 2016-09-29 11:43:22 +08:00
sparc fw_cfg: move FW_CFG_NB_CPUS out of fw_cfg_init1() 2016-11-16 12:09:58 -02:00
sparc64 fw_cfg: move FW_CFG_NB_CPUS out of fw_cfg_init1() 2016-11-16 12:09:58 -02:00
ssi xilinx: fix buffer overflow on realize 2016-10-24 15:27:20 +02:00
timer clean-up: removed duplicate #includes 2016-10-28 18:17:24 +03:00
tpm clean-up: removed duplicate #includes 2016-10-28 18:17:24 +03:00
tricore tricore: remove useless cast 2016-09-15 15:32:22 +03:00
unicore32 clean-up: removed duplicate #includes 2016-10-28 18:17:24 +03:00
usb xen: attach pvusb usb bus to backend qdev 2016-11-22 10:29:41 -08:00
vfio vfio: Add support for mmapping sub-page MMIO BARs 2016-10-31 09:53:04 -06:00
virtio virtio: set ISR on dataplane notifications 2016-11-18 17:29:25 +02:00
watchdog
xen xen: create qdev for each backend device 2016-11-22 10:29:39 -08:00
xenpv xenpv: Fix qemu_uuid compiling error 2016-09-29 11:43:17 +08:00
xtensa char: remove init callback 2016-10-24 15:27:20 +02:00
Makefile.objs STM32F2xx: Add the ADC device 2016-10-04 13:28:07 +01:00