@samitouri / QOSamiQemu / commits / 7228d61b11

hw/intc/arm_gicv5: Avoid NULL dereference in trace line

In the handling of writes to the IRS_SPI_RESAMPLER register, we call a trace function, passing it information about the SPI being resampled. However, spi could be NULL if the guest tried to resample a nonexistent SPI or one configured for a different domain. Move the trace statement inside the "if (spi)" block, as it's only interesting trace if we actually did a resample and potentially changed the state of the SPI. CID: 1959593 Fixes: 33185e1d64e ("hw/intc/arm_gicv5: Update SPI state for CLEAR/SET events") Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Message-id: 20260512093856.3197700-4-peter.maydell@linaro.org

Peter Maydell committed May 12, 2026 at 10:38 UTC 7228d61b110da94b50bccd98835523831b7e4b1f
1 file changed +1 -1
hw/intc/arm_gicv5.c
+1 -1
@@ -1643,8 +1643,8 @@ static bool config_writel(GICv5 *s, GICv5Domain domain, hwaddr offset,
1643 if (spi) {
1644 spi_sample(spi);
1645 irs_recalc_hppi(s, spi->domain, spi->iaffid);
1646 + trace_gicv5_spi_state(id, spi->level, spi->pending, spi->active);
1647 }
1647 - trace_gicv5_spi_state(id, spi->level, spi->pending, spi->active);
1648 return true;
1649 }
1650 case A_IRS_CR0: