[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Stable-9.0.4 50/57] ppc/xive: Fix ESB length overflow on 32-bit hosts
From: |
Michael Tokarev |
Subject: |
[Stable-9.0.4 50/57] ppc/xive: Fix ESB length overflow on 32-bit hosts |
Date: |
Sat, 9 Nov 2024 15:07:52 +0300 |
From: Nicholas Piggin <npiggin@gmail.com>
The length of this region can be > 32-bits, which overflows size_t on
32-bit hosts. Change to uint64_t.
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
(cherry picked from commit 07f2770503e24889720028ddf9ef54788ddf3b6d)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
diff --git a/hw/intc/spapr_xive_kvm.c b/hw/intc/spapr_xive_kvm.c
index 5789062379..7a86197fc9 100644
--- a/hw/intc/spapr_xive_kvm.c
+++ b/hw/intc/spapr_xive_kvm.c
@@ -720,7 +720,7 @@ int kvmppc_xive_connect(SpaprInterruptController *intc,
uint32_t nr_servers,
{
SpaprXive *xive = SPAPR_XIVE(intc);
XiveSource *xsrc = &xive->source;
- size_t esb_len = xive_source_esb_len(xsrc);
+ uint64_t esb_len = xive_source_esb_len(xsrc);
size_t tima_len = 4ull << TM_SHIFT;
CPUState *cs;
int fd;
@@ -824,7 +824,7 @@ void kvmppc_xive_disconnect(SpaprInterruptController *intc)
{
SpaprXive *xive = SPAPR_XIVE(intc);
XiveSource *xsrc;
- size_t esb_len;
+ uint64_t esb_len;
assert(xive->fd != -1);
diff --git a/hw/intc/xive.c b/hw/intc/xive.c
index 057b308ae9..38cb98b0f7 100644
--- a/hw/intc/xive.c
+++ b/hw/intc/xive.c
@@ -1238,7 +1238,7 @@ static void xive_source_reset(void *dev)
static void xive_source_realize(DeviceState *dev, Error **errp)
{
XiveSource *xsrc = XIVE_SOURCE(dev);
- size_t esb_len = xive_source_esb_len(xsrc);
+ uint64_t esb_len = xive_source_esb_len(xsrc);
assert(xsrc->xive);
diff --git a/include/hw/ppc/xive.h b/include/hw/ppc/xive.h
index f120874e0f..00023c0233 100644
--- a/include/hw/ppc/xive.h
+++ b/include/hw/ppc/xive.h
@@ -218,7 +218,7 @@ static inline bool xive_source_esb_has_2page(XiveSource
*xsrc)
xsrc->esb_shift == XIVE_ESB_4K_2PAGE;
}
-static inline size_t xive_source_esb_len(XiveSource *xsrc)
+static inline uint64_t xive_source_esb_len(XiveSource *xsrc)
{
return (1ull << xsrc->esb_shift) * xsrc->nr_irqs;
}
--
2.39.5
- [Stable-9.0.4 40/57] target/riscv/csr.c: Fix an access to VXSAT, (continued)
- [Stable-9.0.4 40/57] target/riscv/csr.c: Fix an access to VXSAT, Michael Tokarev, 2024/11/09
- [Stable-9.0.4 41/57] target/riscv: Correct SXL return value for RV32 in RV64 QEMU, Michael Tokarev, 2024/11/09
- [Stable-9.0.4 43/57] target/riscv: Set vtype.vill on CPU reset, Michael Tokarev, 2024/11/09
- [Stable-9.0.4 42/57] hw/intc: Don't clear pending bits on IRQ lowering, Michael Tokarev, 2024/11/09
- [Stable-9.0.4 44/57] hw/intc/riscv_aplic: Check and update pending when write sourcecfg, Michael Tokarev, 2024/11/09
- [Stable-9.0.4 45/57] target/riscv/kvm: set 'aia_mode' to default in error path, Michael Tokarev, 2024/11/09
- [Stable-9.0.4 46/57] target/riscv/kvm: clarify how 'riscv-aia' default works, Michael Tokarev, 2024/11/09
- [Stable-9.0.4 49/57] target/ppc: Fix mtDPDES targeting SMT siblings, Michael Tokarev, 2024/11/09
- [Stable-9.0.4 47/57] target/riscv: Fix vcompress with rvv_ta_all_1s, Michael Tokarev, 2024/11/09
- [Stable-9.0.4 48/57] target/ppc: Set ctx->opcode for decode_insn32(), Michael Tokarev, 2024/11/09
- [Stable-9.0.4 50/57] ppc/xive: Fix ESB length overflow on 32-bit hosts,
Michael Tokarev <=
- [Stable-9.0.4 51/57] hw/acpi: Fix ordering of BDF in Generic Initiator PCI Device Handle., Michael Tokarev, 2024/11/09
- [Stable-9.0.4 52/57] Revert "target/arm: Fix usage of MMU indexes when EL3 is AArch32", Michael Tokarev, 2024/11/09
- [Stable-9.0.4 53/57] target/arm: Add new MMU indexes for AArch32 Secure PL1&0, Michael Tokarev, 2024/11/09
- [Stable-9.0.4 54/57] target/arm: Fix SVE SDOT/UDOT/USDOT (4-way, indexed), Michael Tokarev, 2024/11/09
- [Stable-9.0.4 55/57] migration: Ensure vmstate_save() sets errp, Michael Tokarev, 2024/11/09
- [Stable-9.0.4 56/57] hw/nvme: fix handling of over-committed queues, Michael Tokarev, 2024/11/09
- [Stable-9.0.4 57/57] 9pfs: fix crash on 'Treaddir' request, Michael Tokarev, 2024/11/09