From patchwork Thu Aug 3 06:45:50 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cyril Bur X-Patchwork-Id: 797012 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3xNLGS4xNdz9s7v for ; Thu, 3 Aug 2017 16:47:44 +1000 (AEST) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3xNLGS43gyzDrM4 for ; Thu, 3 Aug 2017 16:47:44 +1000 (AEST) X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (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 3xNLFB32QdzDrKy for ; Thu, 3 Aug 2017 16:46:38 +1000 (AEST) Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id v736iH9x018253 for ; Thu, 3 Aug 2017 02:46:36 -0400 Received: from e23smtp08.au.ibm.com (e23smtp08.au.ibm.com [202.81.31.141]) by mx0a-001b2d01.pphosted.com with ESMTP id 2c3vcayyuh-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Thu, 03 Aug 2017 02:46:36 -0400 Received: from localhost by e23smtp08.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 3 Aug 2017 16:46:33 +1000 Received: from d23relay07.au.ibm.com (202.81.31.226) by e23smtp08.au.ibm.com (202.81.31.205) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 3 Aug 2017 16:46:31 +1000 Received: from d23av01.au.ibm.com (d23av01.au.ibm.com [9.190.234.96]) by d23relay07.au.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v736kUXa29097986 for ; Thu, 3 Aug 2017 16:46:30 +1000 Received: from d23av01.au.ibm.com (localhost [127.0.0.1]) by d23av01.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id v736kU55018933 for ; Thu, 3 Aug 2017 16:46:30 +1000 Received: from ozlabs.au.ibm.com (ozlabs.au.ibm.com [9.192.253.14]) by d23av01.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id v736kUQq018924 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 83A59A00E8 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:50 +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-0048-0000-0000-000002577B48 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17080306-0049-0000-0000-0000480A4563 Message-Id: <20170803064551.3439-11-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=3 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 11/12] hw/xive: Check return value from xive_decode_vp() (CID 142343 142344) 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" While it is likely that a failure of xive_decode_vp() would simply trip an error condition later on, it makes sense to check for errors earlier and print a (hopefully) more relevant error message. Fixes: CID 142343 and 142344 Signed-off-by: Cyril Bur --- hw/xive.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/hw/xive.c b/hw/xive.c index b830ebe0..2f9567f8 100644 --- a/hw/xive.c +++ b/hw/xive.c @@ -4222,7 +4222,10 @@ static int64_t opal_xive_free_vp_block(uint64_t vp_base) struct xive *x; struct xive_vp *vp; - xive_decode_vp(vp_id, &blk, &idx, NULL, NULL); + if (!xive_decode_vp(vp_id, &blk, &idx, NULL, NULL)) { + prerror("XIVE: Couldn't decode VP id %u\n", vp_id); + return OPAL_INTERNAL_ERROR; + } x = xive_from_pc_blk(blk); if (!x) { prerror("XIVE: Instance not found for deallocated VP" @@ -4289,7 +4292,10 @@ static int64_t opal_xive_alloc_vp_block(uint32_t alloc_order) struct xive *x; struct xive_vp *vp; - xive_decode_vp(vp_id, &blk, &idx, NULL, NULL); + if (!xive_decode_vp(vp_id, &blk, &idx, NULL, NULL)) { + prerror("XIVE: Couldn't decode VP id %u\n", vp_id); + return OPAL_INTERNAL_ERROR; + } x = xive_from_pc_blk(blk); if (!x) { prerror("XIVE: Instance not found for allocated VP"