qemu/hw/xen
Akihiko Odaki 6a67577d80 hw/pci: Replace -1 with UINT32_MAX for romsize
romsize is an uint32_t variable. Specifying -1 as an uint32_t value is
obscure way to denote UINT32_MAX.

Worse, if int is wider than 32-bit, it will change the behavior of a
construct like the following:
romsize = -1;
if (romsize != -1) {
    ...
}

When -1 is assigned to romsize, -1 will be implicitly casted into
uint32_t, resulting in UINT32_MAX. On contrary, when evaluating
romsize != -1, romsize will be casted into int, and it will be a
comparison of UINT32_MAX and -1, and result in false.

Replace -1 with UINT32_MAX for statements involving the variable to
clarify the intent and prevent potential breakage.

Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20240627-reuse-v10-10-7ca0b8ed3d9f@daynix.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2024-07-03 18:14:07 -04:00
..
Kconfig xen: add CONFIG_XEN_BUS and CONFIG_XEN_EMU options for Xen emulation 2023-03-01 08:22:49 +00:00
meson.build hw/xen: cleanup sourcesets 2023-10-18 10:01:01 +02:00
trace-events hw/xen/xen-hvm-common.c: convert DPRINTF to tracepoints 2024-02-02 13:51:59 +00:00
trace.h trace: switch position of headers to what Meson requires 2020-08-21 06:18:24 -04:00
xen_devconfig.c hw/xen: use qemu_create_nic_bus_devices() to instantiate Xen NICs 2024-02-02 16:23:47 +00:00
xen_pt_config_init.c xen/pt: Emulate multifunction bit in header type 2024-03-12 14:13:08 +00:00
xen_pt_graphics.c hw/xen: Extract 'xen_igd.h' from 'xen_pt.h' 2024-03-09 18:51:45 +01:00
xen_pt_load_rom.c hw/pci: Replace -1 with UINT32_MAX for romsize 2024-07-03 18:14:07 -04:00
xen_pt_msi.c hw/xen: Rename xen_common.h to xen_native.h 2023-03-07 17:04:30 +00:00
xen_pt_stub.c hw/xen: Extract 'xen_igd.h' from 'xen_pt.h' 2024-03-09 18:51:45 +01:00
xen_pt.c bulk: Access existing variables initialized to &S->F when available 2024-03-12 11:46:16 +01:00
xen_pt.h hw/xen: Extract 'xen_igd.h' from 'xen_pt.h' 2024-03-09 18:51:45 +01:00
xen_pvdev.c xen: spelling fix 2023-09-08 13:08:52 +03:00
xen-backend.c hw/xen: do not repeatedly try to create a failing backend device 2023-11-07 08:54:20 +00:00
xen-bus-helper.c hw/xen: Add xenstore operations to allow redirection to internal emulation 2023-03-07 17:04:30 +00:00
xen-bus.c xen: initialize legacy backends from xen_bus_init() 2024-05-10 15:45:15 +02:00
xen-host-pci-device.c xen: fix stubdom PCI addr 2024-07-01 14:57:18 +02:00
xen-host-pci-device.h xen: fix stubdom PCI addr 2024-07-01 14:57:18 +02:00
xen-hvm-common.c xen-hvm: Avoid livelock while handling buffered ioreqs 2024-07-01 14:57:18 +02:00
xen-legacy-backend.c hw/xen: Constify xenstore_be::XenDevOps 2024-06-04 11:53:43 +02:00
xen-mapcache.c xen: mapcache: Add support for grant mappings 2024-06-09 20:16:14 +02:00
xen-operations.c xen: Drop support for Xen versions below 4.7.1 2023-06-07 15:07:10 +01:00