On 3/11/26 18:49, Peter Maydell wrote:
On Tue, 3 Nov 2026 at 17:26, Peter Maydell <[email protected]> wrote:
lpi_cache_get_hppi() is a function we pass to g_hash_table_foreach()
to iterate over the LPI cache hashtable. This hash table has keys
which are GINT_TO_POINTER(intid) and values which hold the L2 ISTE
value, allocated as "hashvalue = g_new(uint32_t, 1)".
The function is passed the key and value as type 'gpointer' and has
to cast them to the real types itself, but it incorrectly casts the
value pointer to a uint64_t*. This works on little-endian hosts
(since we only read specific fields of the L2 ISTE using bitmasking),
but won't work on big-endian, and trips the clang sanitizer.
Fix the pointer type.
Cc: [email protected]
Fixes: a0562ada75e ("hw/intc/arm_gicv5: Calculate HPPI in the IRS")
Signed-off-by: Peter Maydell <[email protected]>
---
hw/intc/arm_gicv5.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hw/intc/arm_gicv5.c b/hw/intc/arm_gicv5.c
index fd6456cd8aa..a362349e5ed 100644
--- a/hw/intc/arm_gicv5.c
+++ b/hw/intc/arm_gicv5.c
@@ -390,7 +390,7 @@ typedef struct GetHPPIUserData {
static void lpi_cache_get_hppi(gpointer key, gpointer value, gpointer
user_data)
{
uint64_t id = GPOINTER_TO_INT(key);
- uint64_t l2_iste = *(uint64_t *)value;
+ uint64_t l2_iste = *(uint32_t *)value;
uint32_t prio, iaffid;
GetHPPIUserData *ud = user_data;
Looking at this again we could also make the local variable
be uint32_t; but getting the type wrong on that doesn't matter.
Should we use GUINT_TO_POINTER() when inserting in put_l2_iste()
and recover here with GPOINTER_TO_UINT()?