]> git.ipfire.org Git - thirdparty/qemu.git/commit
hw/xen: fix off-by-one in xen_evtchn_set_gsi()
authorDavid Woodhouse <dwmw@amazon.co.uk>
Fri, 7 Apr 2023 15:12:00 +0000 (17:12 +0200)
committerMichael Tokarev <mjt@tls.msk.ru>
Fri, 4 Aug 2023 16:14:46 +0000 (19:14 +0300)
commitf8592e94315813c96d46c7654e88caf24ea3fb56
treee12d1b19cde4b4b5ee74b8321fabc05912869d07
parent5300472ec0990c61742d89b5eea1c1e6941f6d62
hw/xen: fix off-by-one in xen_evtchn_set_gsi()

Coverity points out (CID 1508128) a bounds checking error. We need to check
for gsi >= IOAPIC_NUM_PINS, not just greater-than.

Also fix up an assert() that has the same problem, that Coverity didn't see.

Fixes: 4f81baa33ed6 ("hw/xen: Support GSI mapping to PIRQ")
Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20230801175747.145906-2-dwmw2@infradead.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
(cherry picked from commit cf885b19579646d6a085470658bc83432d6786d2)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
hw/i386/kvm/xen_evtchn.c