From patchwork Mon Mar 27 09:06:22 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joshua Otto X-Patchwork-Id: 9645711 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 10F02602C8 for ; Mon, 27 Mar 2017 09:11:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EB8EA27A98 for ; Mon, 27 Mar 2017 09:11:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DD58F28335; Mon, 27 Mar 2017 09:11:35 +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.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID 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 E705527A98 for ; Mon, 27 Mar 2017 09:11:34 +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 1csQeZ-0005iH-Dy; Mon, 27 Mar 2017 09:09:31 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1csQeX-0005ha-IE for xen-devel@lists.xenproject.org; Mon, 27 Mar 2017 09:09:29 +0000 Received: from [85.158.137.68] by server-9.bemta-3.messagelabs.com id 06/71-20914-8C6D8D85; Mon, 27 Mar 2017 09:09:28 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrAIsWRWlGSWpSXmKPExsXSmNjwSffEtRs RBitei1l83zKZyYHR4/CHKywBjFGsmXlJ+RUJrBnPtnkUvGarmHx7LWMD4yPWLkYuDiGBJUwS Hce+sXcxcnKwCPhIbHl5jxHC/s8ksXlFOYjNJqAusX3RRrAaEQEliXurJjOBNDMLHGSUOHP+M DNIQlggQOL/xf3MEM2qEr8P/wQbxCvgItHQ8p4FxJYQkJO4ea4TrIYTKH7s4iE2EFtIwFni2u FeoHoOoJpiicsrYyDKQyRO7n7IDBHWkTjzpBgiHC+xf/9sJoiwicSDKZ4QYVGJ7sPPGEEukxC Yzyixbd1OxgmMwgsYGVYxahSnFpWlFukameklFWWmZ5TkJmbm6BoaGOvlphYXJ6an5iQmFesl 5+duYgSGZj0DA+MOxoa9focYJTmYlER5P5y+ESHEl5SfUpmRWJwRX1Sak1p8iFGGg0NJgvfAV aCcYFFqempFWmYOMEpg0hIcPEoivCtA0rzFBYm5xZnpEKlTjLocN44feMMkxJKXn5cqJc47Fa RIAKQoozQPbgQsYi8xykoJ8zIyMDAI8RSkFuVmlqDKv2IU52BUEub9BjKFJzOvBG7TK6AjmIC OODwf7IiSRISUVAPjnEQRCelGnikGPPJhdpfbLuxu3ZnovSY2K7n0Qcgxgbstuj7L1r2f+Sdy yYUKkbenJSYwn9uhW1y0+MFWhbeM15mzeD2UZW7cubb77YqJLP0yWv7vTvsuyju5Zv3FdZp9B oudTKzn6x+/a3inPjL5TTWzQbfuA4mCj/X1Mr91X6/oirVJ/ZylxFKckWioxVxUnAgA6t3jwt MCAAA= X-Env-Sender: jtotto@uwaterloo.ca X-Msg-Ref: server-4.tower-31.messagelabs.com!1490605766!34138136!1 X-Originating-IP: [129.97.128.242] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.2.3; banners=-,-,- X-VirusChecked: Checked Received: (qmail 16832 invoked from network); 27 Mar 2017 09:09:28 -0000 Received: from mailchk-m06.uwaterloo.ca (HELO mailchk-m06.uwaterloo.ca) (129.97.128.242) by server-4.tower-31.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 27 Mar 2017 09:09:28 -0000 Received: from eagle.uwaterloo.ca (cs-auth-dc-129-97-60-142.dynamic.uwaterloo.ca [129.97.60.142]) (authenticated bits=0) by mailchk-m06.uwaterloo.ca (8.14.4/8.14.4) with ESMTP id v2R97DTQ023326 (version=TLSv1/SSLv3 cipher=AES128-SHA256 bits=128 verify=NO); Mon, 27 Mar 2017 05:08:50 -0400 DKIM-Filter: OpenDKIM Filter v2.11.0 mailchk-m06.uwaterloo.ca v2R97DTQ023326 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=uwaterloo.ca; s=default; t=1490605765; bh=rYol2I3QTs7wZmKunfZouhMkpnAUsiytFiIQpf8DR6A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=y93+o+PSqMFhKva4TGTHqI67GKAN14+5paKbDOnB3nIZXDLxEwlBRFhNywK4JkixW Ch+Y9p4eVwQiaxw0I9Y/JbxiGbQ7SrTvatczyOb1m0jBaPyQzfDb9dvFrigdrUOILU A/oXNxnzU0U1sH5Bx75E7JuHt0T68OCuI6dXua74= From: Joshua Otto To: xen-devel@lists.xenproject.org Date: Mon, 27 Mar 2017 05:06:22 -0400 Message-Id: <1490605592-12189-11-git-send-email-jtotto@uwaterloo.ca> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1490605592-12189-1-git-send-email-jtotto@uwaterloo.ca> References: <1490605592-12189-1-git-send-email-jtotto@uwaterloo.ca> X-UUID: d6a8cc11-8bbe-41ad-9645-80e51f0a07fd X-Miltered: at mailchk-m06 with ID 58D8D641.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Virus-Scanned: clamav-milter 0.99.2 at mailchk-m06 X-Virus-Status: Clean X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.6.2 (mailchk-m06.uwaterloo.ca [129.97.128.141]); Mon, 27 Mar 2017 05:09:25 -0400 (EDT) Cc: wei.liu2@citrix.com, andrew.cooper3@citrix.com, ian.jackson@eu.citrix.com, czylin@uwaterloo.ca, Joshua Otto , imhy.yang@gmail.com, hjarmstr@uwaterloo.ca Subject: [Xen-devel] [PATCH RFC 10/20] libxc/xc_sr_save.c: initialise rec.data before free() 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 colo_merge_secondary_dirty_bitmap() unconditionally free()s the .data member of its local xc_sr_record structure rec on its exit path. However, if the initial call to read_record() fails then this member is uninitialised. Initialise it. Signed-off-by: Joshua Otto Reviewed-by: Andrew Cooper --- tools/libxc/xc_sr_save.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/libxc/xc_sr_save.c b/tools/libxc/xc_sr_save.c index ac97d93..6acc8d3 100644 --- a/tools/libxc/xc_sr_save.c +++ b/tools/libxc/xc_sr_save.c @@ -681,7 +681,7 @@ static int send_memory_live(struct xc_sr_context *ctx) static int colo_merge_secondary_dirty_bitmap(struct xc_sr_context *ctx) { xc_interface *xch = ctx->xch; - struct xc_sr_record rec; + struct xc_sr_record rec = { 0, 0, NULL }; uint64_t *pfns = NULL; uint64_t pfn; unsigned count, i;