qemu-e2k/hw/pci
Daniella Lee bacf58ca18 Fix bad overflow check in hw/pci/pcie.c
Orginal qemu commit hash:14d02cfbe4adaeebe7cb833a8cc71191352cf03b

In function pcie_add_capability, an assert contains the
"offset < offset + size" expression.
Both variable offset and variable size are uint16_t,
the comparison is always true due to type promotion.
The next expression may be the same.

It might be like this:
Thread 1 "qemu-system-x86" hit Breakpoint 1, pcie_add_capability (
    dev=0x555557ce5f10, cap_id=1, cap_ver=2 '\002', offset=256, size=72)
    at ../hw/pci/pcie.c:930
930	{
(gdb) n
931	    assert(offset >= PCI_CONFIG_SPACE_SIZE);
(gdb) n
932	    assert(offset < offset + size);
(gdb) p offset
$1 = 256
(gdb) p offset < offset + size
$2 = 1
(gdb) set offset=65533
(gdb) p offset < offset + size
$3 = 1
(gdb) p offset < (uint16_t)(offset + size)
$4 = 0

Signed-off-by: Daniella Lee <daniellalee111@gmail.com>
Message-Id: <20211126061324.47331-1-daniellalee111@gmail.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2021-11-29 08:49:36 -05:00
..
Kconfig
meson.build
msi.c
msix.c
pci_bridge.c pci: fix PCI resource reserve capability on BE 2021-10-20 06:18:17 -04:00
pci_host.c pci: implement power state 2021-11-15 11:10:11 -05:00
pci-stub.c
pci.c pci: implement power state 2021-11-15 11:10:11 -05:00
pcie_aer.c
pcie_host.c
pcie_port.c pcie: rename 'native-hotplug' to 'x-native-hotplug' 2021-11-15 09:44:46 -05:00
pcie.c Fix bad overflow check in hw/pci/pcie.c 2021-11-29 08:49:36 -05:00
shpc.c
slotid_cap.c
trace-events docs: fix references to docs/devel/tracing.rst 2021-06-02 06:51:09 +02:00
trace.h