[Skiboot] [PATCH 12/12] hw/xive: Fix unchecked return value in opal_xive_dump_emu() (CID 144257)

Cyril Bur cyril.bur at au1.ibm.com
Thu Aug 3 16:45:51 AEST 2017


This is a function to display information, if xive_get_irq_targetting()
fails then the target printed would be the initial value of 0xFF. It
costs nothing to check the return value and print very obviously
question marks.

Fixes: CID 144257
Signed-off-by: Cyril Bur <cyril.bur at au1.ibm.com>
---
 hw/xive.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/hw/xive.c b/hw/xive.c
index 2f9567f8..ea487992 100644
--- a/hw/xive.c
+++ b/hw/xive.c
@@ -4515,7 +4515,7 @@ static int64_t opal_xive_dump_emu(uint32_t pir)
 	struct cpu_thread *c = find_cpu_by_pir(pir);
 	struct xive_cpu_state *xs;
 	struct xive_eq *eq;
-	uint32_t ipi_target = -1u;
+	uint32_t ipi_target;
 	uint8_t *mm, pq;
 
 	if (!c)
@@ -4546,9 +4546,14 @@ static int64_t opal_xive_dump_emu(uint32_t pir)
 
 	mm = xs->xive->esb_mmio + GIRQ_TO_IDX(xs->ipi_irq) * 0x20000;
 	pq = in_8(mm + 0x10800);
-	xive_get_irq_targetting(xs->ipi_irq, &ipi_target, NULL, NULL);
-	prlog(PR_INFO, "CPU[%04x]: IPI #%08x PQ=%x target=%08x\n",
-	      pir, xs->ipi_irq, pq, ipi_target);
+	if (xive_get_irq_targetting(xs->ipi_irq, &ipi_target, NULL, NULL))
+		prlog(PR_INFO, "CPU[%04x]: IPI #%08x PQ=%x target=%08x\n",
+				pir, xs->ipi_irq, pq, ipi_target);
+	else
+		prlog(PR_INFO, "CPU[%04x]: IPI #%08x PQ=%x target=??\n",
+				pir, xs->ipi_irq, pq);
+
+
 
 	__xive_cache_scrub(xs->xive, xive_cache_eqc, xs->eq_blk,
 			   xs->eq_idx + XIVE_EMULATION_PRIO,
-- 
2.13.3



More information about the Skiboot mailing list