From patchwork Mon Jan 18 17:23:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tamas K Lengyel X-Patchwork-Id: 12027933 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2C512C433DB for ; Mon, 18 Jan 2021 17:23:24 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CD87222C9E for ; Mon, 18 Jan 2021 17:23:23 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CD87222C9E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=tklengyel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.69909.125312 (Exim 4.92) (envelope-from ) id 1l1YFH-0008Lb-Ih; Mon, 18 Jan 2021 17:23:15 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 69909.125312; Mon, 18 Jan 2021 17:23:15 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1l1YFH-0008LU-F9; Mon, 18 Jan 2021 17:23:15 +0000 Received: by outflank-mailman (input) for mailman id 69909; Mon, 18 Jan 2021 17:23:13 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1l1YFF-0008LO-TE for xen-devel@lists.xenproject.org; Mon, 18 Jan 2021 17:23:13 +0000 Received: from MTA-08-4.privateemail.com (unknown [198.54.122.58]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 5bf2b0ad-0d06-4283-b09c-e8d6e9a9dc53; Mon, 18 Jan 2021 17:23:12 +0000 (UTC) Received: from MTA-08.privateemail.com (localhost [127.0.0.1]) by MTA-08.privateemail.com (Postfix) with ESMTP id 9D4F360098; Mon, 18 Jan 2021 12:23:11 -0500 (EST) Received: from t9.localdomain (unknown [10.20.151.225]) by MTA-08.privateemail.com (Postfix) with ESMTPA id 8D8056007B; Mon, 18 Jan 2021 17:23:10 +0000 (UTC) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 5bf2b0ad-0d06-4283-b09c-e8d6e9a9dc53 From: Tamas K Lengyel To: xen-devel@lists.xenproject.org Cc: Tamas K Lengyel , Jan Beulich , Andrew Cooper , George Dunlap , =?utf-8?q?Roger_Pau_Monn=C3=A9?= , Wei Liu Subject: [PATCH] x86/mem_sharing: fix uninitialized 'preempted' variable Date: Mon, 18 Jan 2021 10:23:06 -0700 Message-Id: X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Virus-Scanned: ClamAV using ClamSMTP UBSAN catches an uninitialized use of the 'preempted' variable in fork_hap_allocation when there is no preemption. Signed-off-by: Tamas K Lengyel Acked-by: Andrew Cooper --- xen/arch/x86/mm/mem_sharing.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xen/arch/x86/mm/mem_sharing.c b/xen/arch/x86/mm/mem_sharing.c index c8a6d11b90..adaeab4612 100644 --- a/xen/arch/x86/mm/mem_sharing.c +++ b/xen/arch/x86/mm/mem_sharing.c @@ -1644,7 +1644,7 @@ static int copy_vcpu_settings(struct domain *cd, const struct domain *d) static int fork_hap_allocation(struct domain *cd, struct domain *d) { int rc; - bool preempted; + bool preempted = false; unsigned long mb = hap_get_allocation(d); if ( mb == hap_get_allocation(cd) )