From patchwork Thu Aug 3 06:45:51 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cyril Bur X-Patchwork-Id: 797016 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3xNLHC6b85z9s7v for ; Thu, 3 Aug 2017 16:48:23 +1000 (AEST) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3xNLHC4wrMzDrVt for ; Thu, 3 Aug 2017 16:48:23 +1000 (AEST) X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3xNLFC4fBPzDrKy for ; Thu, 3 Aug 2017 16:46:39 +1000 (AEST) Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id v736hdjq094782 for ; Thu, 3 Aug 2017 02:46:37 -0400 Received: from e23smtp03.au.ibm.com (e23smtp03.au.ibm.com [202.81.31.145]) by mx0a-001b2d01.pphosted.com with ESMTP id 2c3r33acxw-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Thu, 03 Aug 2017 02:46:37 -0400 Received: from localhost by e23smtp03.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 3 Aug 2017 16:46:34 +1000 Received: from d23relay10.au.ibm.com (202.81.31.229) by e23smtp03.au.ibm.com (202.81.31.209) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 3 Aug 2017 16:46:31 +1000 Received: from d23av06.au.ibm.com (d23av06.au.ibm.com [9.190.235.151]) by d23relay10.au.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v736kVbA25296988 for ; Thu, 3 Aug 2017 16:46:31 +1000 Received: from d23av06.au.ibm.com (localhost [127.0.0.1]) by d23av06.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id v736kUon029753 for ; Thu, 3 Aug 2017 16:46:31 +1000 Received: from ozlabs.au.ibm.com (ozlabs.au.ibm.com [9.192.253.14]) by d23av06.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id v736kUcw029750 for ; Thu, 3 Aug 2017 16:46:30 +1000 Received: from camb691.ozlabs.ibm.com (haven.au.ibm.com [9.192.254.114]) (using TLSv1.2 with cipher DHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.au.ibm.com (Postfix) with ESMTPSA id 908AEA01CA for ; Thu, 3 Aug 2017 16:46:30 +1000 (AEST) From: Cyril Bur To: skiboot@lists.ozlabs.org Date: Thu, 3 Aug 2017 16:45:51 +1000 X-Mailer: git-send-email 2.13.3 In-Reply-To: <20170803064551.3439-1-cyril.bur@au1.ibm.com> References: <20170803064551.3439-1-cyril.bur@au1.ibm.com> X-TM-AS-MML: disable x-cbid: 17080306-0008-0000-0000-0000015272A4 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17080306-0009-0000-0000-00000984121F Message-Id: <20170803064551.3439-12-cyril.bur@au1.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-08-03_03:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=1 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1706020000 definitions=main-1708030104 Subject: [Skiboot] [PATCH 12/12] hw/xive: Fix unchecked return value in opal_xive_dump_emu() (CID 144257) X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" 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 --- 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,