From patchwork Wed Jun 19 21:24:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Stefano Stabellini X-Patchwork-Id: 11005299 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A78811395 for ; Wed, 19 Jun 2019 21:25:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A25F128774 for ; Wed, 19 Jun 2019 21:25:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 96EDE28789; Wed, 19 Jun 2019 21:25:51 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.0 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4130828774 for ; Wed, 19 Jun 2019 21:25:51 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hdi4D-0000YO-Lf; Wed, 19 Jun 2019 21:24:29 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hdi4B-0000YG-GQ for xen-devel@lists.xenproject.org; Wed, 19 Jun 2019 21:24:27 +0000 X-Inumbo-ID: 9d45540c-92d8-11e9-8980-bc764e045a96 Received: from mail.kernel.org (unknown [198.145.29.99]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTPS id 9d45540c-92d8-11e9-8980-bc764e045a96; Wed, 19 Jun 2019 21:24:26 +0000 (UTC) Received: from localhost (c-67-164-102-47.hsd1.ca.comcast.net [67.164.102.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 50C862084A; Wed, 19 Jun 2019 21:24:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1560979465; bh=Gzyth5lRQK1tPGkua1aysnLFOiU6aZzeObMkukRBdMg=; h=Date:From:To:cc:Subject:From; b=AnCLeHYQnjdb3UyrafkXZ26PO2NrNt5P3v2owT+UlmS6WQ3xtenRGWMorELuDsxCD gQ0yo43TlLZQ+b820IDtMxyiSYCbI2W5PFr5fx8conx7+bxGV3RzctjTd6nNvDGF94 45ji4/mB3b4wioXr0Js5xlhhiYaOKenQZXJUOuaY= Date: Wed, 19 Jun 2019 14:24:24 -0700 (PDT) From: Stefano Stabellini X-X-Sender: sstabellini@sstabellini-ThinkPad-T480s To: xen-devel@lists.xenproject.org Message-ID: User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-ID: Subject: [Xen-devel] [PATCH] xen/arm: fix build after 2e35cdf X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: andrew.cooper3@citrix.com, julien.grall@arm.com, sstabellini@kernel.org, Volodymyr_Babchuk@epam.com Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP Optee breaks the build with: optee.c: In function ‘translate_noncontig.isra.4’: optee.c:743:38: error: ‘xen_data’ may be used uninitialized in this function [-Werror=maybe-uninitialized] xen_data->next_page_data = page_to_maddr(xen_pgs + 1); ^ optee.c:732:71: error: ‘guest_data’ may be used uninitialized in this function [-Werror=maybe-uninitialized] page = get_domain_ram_page(gaddr_to_gfn(guest_data->pages_list[idx])); ^ optee.c:750:21: error: ‘guest_pg’ may be used uninitialized in this function [-Werror=maybe-uninitialized] put_page(guest_pg); ^ cc1: all warnings being treated as errors Fix it by initializing xen_data, guest_data, guest_pg to NULL. Also set xen_pgs to NULL for consistency. Signed-off-by: Stefano Stabellini diff --git a/xen/arch/arm/tee/optee.c b/xen/arch/arm/tee/optee.c index 28d34360fc..4825cc5410 100644 --- a/xen/arch/arm/tee/optee.c +++ b/xen/arch/arm/tee/optee.c @@ -663,7 +663,7 @@ static int translate_noncontig(struct optee_domain *ctx, unsigned int order; unsigned int idx = 0; gfn_t gfn; - struct page_info *guest_pg, *xen_pgs; + struct page_info *guest_pg = NULL, *xen_pgs = NULL; struct optee_shm_buf *optee_shm_buf; /* * This is memory layout for page list. Basically list consists of 4k pages, @@ -675,7 +675,7 @@ static int translate_noncontig(struct optee_domain *ctx, struct { uint64_t pages_list[PAGELIST_ENTRIES_PER_PAGE]; uint64_t next_page_data; - } *guest_data, *xen_data; + } *guest_data = NULL, *xen_data = NULL; /* Offset of user buffer withing OPTEE_MSG_NONCONTIG_PAGE_SIZE-sized page */ offset = param->u.tmem.buf_ptr & (OPTEE_MSG_NONCONTIG_PAGE_SIZE - 1);