i386/acpi: fix gint overflow in crs_range_compare
commit11665ca918b49964adc9adb06ee382691b72cb7d
authorEvgeny Yakovlev <wrfsh@yandex-team.ru>
Thu, 18 Jul 2019 16:14:23 +0000 (18 19:14 +0300)
committerMichael Roth <mdroth@linux.vnet.ibm.com>
Tue, 30 Jul 2019 17:11:24 +0000 (30 12:11 -0500)
treec5022acc28178b1c32199da46d55d60e57ea15dd
parentdf42bc4897d80d9a005ad94937e594dab132adc3
i386/acpi: fix gint overflow in crs_range_compare

When very large regions (32GB sized in our case, PCI pass-through of GPUs)
are compared substraction result does not fit into gint.

As a result crs_replace_with_free_ranges does not get sorted ranges and
incorrectly computes PCI64 free space regions. Which then makes linux
guest complain about device and PCI64 hole intersection and device
becomes unusable.

Fix that by returning exactly fitting ranges.

Also fix indentation of an entire crs_replace_with_free_ranges to make
checkpatch happy.

Cc: qemu-stable@nongnu.org
Signed-off-by: Evgeny Yakovlev <wrfsh@yandex-team.ru>
Message-Id: <1563466463-26012-1-git-send-email-wrfsh@yandex-team.ru>
Signed-off-by: Evgeny Yakovlev <wrfsh@yandex-team.ru>
(cherry picked from commit 21e2acd583126db94f6d881005cd58e835160582)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
hw/i386/acpi-build.c