From patchwork Wed Nov 11 05:38:07 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stewart Smith X-Patchwork-Id: 542783 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 AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id B5C3E14141D for ; Wed, 11 Nov 2015 16:38:21 +1100 (AEDT) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 780E71A0259 for ; Wed, 11 Nov 2015 16:38:21 +1100 (AEDT) X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Received: from e32.co.us.ibm.com (e32.co.us.ibm.com [32.97.110.150]) (using TLSv1 with cipher CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id B76C01A021E for ; Wed, 11 Nov 2015 16:38:17 +1100 (AEDT) Received: from localhost by e32.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 10 Nov 2015 22:38:14 -0700 Received: from d03dlp01.boulder.ibm.com (9.17.202.177) by e32.co.us.ibm.com (192.168.1.132) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 10 Nov 2015 22:38:13 -0700 X-IBM-Helo: d03dlp01.boulder.ibm.com X-IBM-MailFrom: stewart@linux.vnet.ibm.com X-IBM-RcptTo: skiboot@lists.ozlabs.org Received: from b03cxnp08028.gho.boulder.ibm.com (b03cxnp08028.gho.boulder.ibm.com [9.17.130.20]) by d03dlp01.boulder.ibm.com (Postfix) with ESMTP id 6FD0E1FF0021 for ; Tue, 10 Nov 2015 22:26:24 -0700 (MST) Received: from d03av02.boulder.ibm.com (d03av02.boulder.ibm.com [9.17.195.168]) by b03cxnp08028.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id tAB5ajPQ9372082 for ; Tue, 10 Nov 2015 22:36:45 -0700 Received: from d03av02.boulder.ibm.com (localhost [127.0.0.1]) by d03av02.boulder.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id tAB5cCXE030852 for ; Tue, 10 Nov 2015 22:38:12 -0700 Received: from oc8180480414.ibm.com (oc8180480414.ibm.com.au.ibm.com [9.185.215.29]) by d03av02.boulder.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id tAB5cB7E030817; Tue, 10 Nov 2015 22:38:12 -0700 Received: from ka1.ozlabs.ibm.com (localhost [127.0.0.1]) by oc8180480414.ibm.com (Postfix) with ESMTP id B60E65667; Wed, 11 Nov 2015 16:38:10 +1100 (AEDT) From: Stewart Smith To: skiboot@lists.ozlabs.org Date: Wed, 11 Nov 2015 16:38:07 +1100 Message-Id: <1447220287-614-3-git-send-email-stewart@linux.vnet.ibm.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1447220287-614-1-git-send-email-stewart@linux.vnet.ibm.com> References: <1447220287-614-1-git-send-email-stewart@linux.vnet.ibm.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 15111105-0005-0000-0000-000019B8896D Subject: [Skiboot] [PATCH 2/2] Check return result of sbe_xip_get_section in sbe_xip_image.c X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.20 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" In the event of failure, stringsSection will be untouched, which is very likely not a good thing as then we'll just use garbage in the following line. Signed-off-by: Stewart Smith --- libpore/sbe_xip_image.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libpore/sbe_xip_image.c b/libpore/sbe_xip_image.c index 800892c565a6..7ee48864432c 100644 --- a/libpore/sbe_xip_image.c +++ b/libpore/sbe_xip_image.c @@ -1070,8 +1070,11 @@ xipDecodeToc(void* i_image, o_item->iv_toc = i_imageToc; o_item->iv_type = hostToc.iv_type; o_item->iv_elements = hostToc.iv_elements; - - sbe_xip_get_section(i_image, SBE_XIP_SECTION_STRINGS, &stringsSection); + + rc = sbe_xip_get_section(i_image, SBE_XIP_SECTION_STRINGS, + &stringsSection); + if (rc) break; + o_item->iv_id = (char*)i_image + stringsSection.iv_offset + hostToc.iv_id;