From patchwork Sat Aug 19 14:21:42 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Petazzoni X-Patchwork-Id: 9910523 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 00D0F600C8 for ; Sat, 19 Aug 2017 14:24:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DDBBA28D51 for ; Sat, 19 Aug 2017 14:24:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BF28628D5A; Sat, 19 Aug 2017 14:24:46 +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=-4.2 required=2.0 tests=BAYES_00, 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 AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 9BFEB28D51 for ; Sat, 19 Aug 2017 14:24:45 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dj4dH-0007cx-TK; Sat, 19 Aug 2017 14:21:47 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dj4dG-0007cr-So for xen-devel@lists.xen.org; Sat, 19 Aug 2017 14:21:47 +0000 Received: from [85.158.137.68] by server-2.bemta-3.messagelabs.com id 8F/F5-22472-97948995; Sat, 19 Aug 2017 14:21:45 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrNLMWRWlGSWpSXmKPExsVix8JvplvhOSP S4PUWTYslHxezODB6HN39mymAMYo1My8pvyKBNWPWjKuMBTu5KnYdu8jWwPiOo4uRk0NIoEyi 6d0tRhBbQiBYYvHtJawQNp/ExRc/mCDsbkaJM/vTuhi5gOo3MEpcWj6fvYuRg4NNwEbiQBcLS I2IgLTEtc+XweYwCyRJzPp0jA2kRFjAR2JWMw9ImEVAVWLm4ZNsIDavgIdE4+EFUKvkJJZuv8 48gZFnASPDKkb14tSistQiXUu9pKLM9IyS3MTMHF1DA2O93NTi4sT01JzEpGK95PzcTYxAj9c zMDDuYHz90+kQoyQHk5Io7+9ZUyKF+JLyUyozEosz4otKc1KLDzHKcHAoSfAWecyIFBIsSk1P rUjLzAGGHkxagoNHSYS3HCTNW1yQmFucmQ6ROsWoy7Fh9fovTEIsefl5qVLivPEgRQIgRRmle XAjYHFwiVFWSpiXkYGBQYinILUoN7MEVf4VozgHo5Iw72SQKTyZeSVwm14BHcEEdIRh6zSQI0 oSEVJSDYwip4T7Wf1+uWXV5pe76soqL95mrvAymUfIdq7E5ek5pipyecW+nlU9CVP5fJTvtlo f+Oe8aPIp9XDOlcuMggqDv0jvMa7ya50jeuecbhTvevVJ78J2/thjn79i9tKYLZzekz47Vl8U mmVkfuVvOS9vU/6VorbEp82+wV/v7zjXdbDkuX1nuBJLcUaioRZzUXEiAH68BbV+AgAA X-Env-Sender: thomas.petazzoni@free-electrons.com X-Msg-Ref: server-14.tower-31.messagelabs.com!1503152504!110540389!1 X-Originating-IP: [62.4.15.54] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 63741 invoked from network); 19 Aug 2017 14:21:44 -0000 Received: from mail.free-electrons.com (HELO mail.free-electrons.com) (62.4.15.54) by server-14.tower-31.messagelabs.com with SMTP; 19 Aug 2017 14:21:44 -0000 Received: by mail.free-electrons.com (Postfix, from userid 110) id C97A421D7B; Sat, 19 Aug 2017 16:21:43 +0200 (CEST) Received: from localhost (132.230.147.77.rev.sfr.net [77.147.230.132]) by mail.free-electrons.com (Postfix) with ESMTPSA id 5BD4A21D61; Sat, 19 Aug 2017 16:21:43 +0200 (CEST) From: Thomas Petazzoni To: xen-devel@lists.xen.org Date: Sat, 19 Aug 2017 16:21:42 +0200 Message-Id: <20170819142142.18673-1-thomas.petazzoni@free-electrons.com> X-Mailer: git-send-email 2.9.4 Cc: Bernd Kuhls , Thomas Petazzoni Subject: [Xen-devel] [PATCH] tools/libxc/xc_dom_arm: add missing variable initialization X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Bernd Kuhls The variable domctl.u.address_size.size may remain uninitialized if guest_type is not one of xen-3.0-aarch64 or xen-3.0-armv7l. And the code precisely checks if this variable is still 0 to decide if the guest type is supported or not. This fixes the following build failure with gcc 7.x: xc_dom_arm.c:229:31: error: 'domctl.u.address_size.size' may be used uninitialized in this function [-Werror=maybe-uninitialized] if ( domctl.u.address_size.size == 0 ) Patch originally taken from https://www.mail-archive.com/xen-devel@lists.xen.org/msg109313.html. Signed-off-by: Bernd Kuhls Signed-off-by: Thomas Petazzoni Acked-by: Wei Liu --- tools/libxc/xc_dom_arm.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/libxc/xc_dom_arm.c b/tools/libxc/xc_dom_arm.c index e7d4bd0..e669fb0 100644 --- a/tools/libxc/xc_dom_arm.c +++ b/tools/libxc/xc_dom_arm.c @@ -223,6 +223,8 @@ static int set_mode(xc_interface *xch, domid_t domid, char *guest_type) domctl.domain = domid; domctl.cmd = XEN_DOMCTL_set_address_size; + domctl.u.address_size.size = 0; + for ( i = 0; i < ARRAY_SIZE(types); i++ ) if ( !strcmp(types[i].guest, guest_type) ) domctl.u.address_size.size = types[i].size;