From nobody Mon Feb 9 09:29:48 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=reject dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1613144467; cv=none; d=zohomail.com; s=zohoarc; b=Up5Mn4p6jUBEykqNGHul/h2aicKzJMNLybWi7ue6b7aqsVVgWdqmTpN0QD9dnVTfWhVhtRl4jBiuussrBDdbWQp1UXgHcDNbyOWqskPsobEMPeffl1Hl8k/Zw70ySDU7jwbEOEBSdLRlYxEbvNpyPkpljExpU0XI3PV2MccFa5c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1613144467; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=cciFLAUgQJVYMPiADIBwuOkrWYgu4KKkeotJl4H/dUg=; b=oK3R8s3azX60s0jOqyt6+RV/XHBB9+R16zhnkPsO1rPcSTmDOT75SRb6rzDaOz/nwD5Q2it5GuqiEaJrDfw7Wo/qanqE9RjfLCzH2nhnbH0wCcomYl1pm+R9YuoaIE+JjeL/yVwUIfvKPnUHMtRYXO+VVD87hXKwmSno2P/xqXQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=reject dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1613144466608270.5733704000613; Fri, 12 Feb 2021 07:41:06 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.84313.158110 (Exim 4.92) (envelope-from ) id 1lAaYu-0001DH-OA; Fri, 12 Feb 2021 15:40:52 +0000 Received: by outflank-mailman (output) from mailman id 84313.158110; Fri, 12 Feb 2021 15:40:52 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lAaYu-0001D6-Ju; Fri, 12 Feb 2021 15:40:52 +0000 Received: by outflank-mailman (input) for mailman id 84313; Fri, 12 Feb 2021 15:40:50 +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 1lAaYs-0000ix-Of for xen-devel@lists.xenproject.org; Fri, 12 Feb 2021 15:40:50 +0000 Received: from esa1.hc3370-68.iphmx.com (unknown [216.71.145.142]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id a1986579-83f5-4a77-bdee-3db06d09e860; Fri, 12 Feb 2021 15:40:18 +0000 (UTC) X-Outflank-Mailman: Message body and most headers restored to incoming version 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: a1986579-83f5-4a77-bdee-3db06d09e860 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1613144418; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=gxhqNkRAqt4D8bXDbOgXUWNa09LADvFwdwUf17wrXSw=; b=R80rtD6giKjL9kkupOQKKmhZjbkW2sQNjKwX05b5yJXbs9z/+Wh2Oh8Y wBCRzI1kVVIlH+GrxxTQFljGsMG7vdolxK2D/VyDk63Pi2f5hqjzjhX/D BhQI/1/RlqriAzW01Nxx+rlG1MMpaSoKDgbnxk4zUtE/sFQykLjeylwmX c=; Authentication-Results: esa1.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none IronPort-SDR: RKCf/rOpegXLOR/rGRr2O17NtjZ96m2jnR3RcZHKCvoQth9eyEg3hr5TXOSDVPvgM0hU3RP9Aa ZVOhfKHBDiTJiOdeiIU6J5DxCSf0wNjoLhH7UBPAxE4pBz20I1moCLLE/ShGQEXpmfs+JaYhox 12z0e8R2UXettahbW/Q5PZParO3n5jo7rd6f5wowS7uXtCZ9xn/G+nqF08eMN5LuhHyNStgQIT Yi08sSeTUiPiUoq9vfqO6JvSBTsNMk9XGB1JbJlu/wUEmezF15cR6TZYRsKS9L+4qlOtAEsiUh usQ= X-SBRS: 5.2 X-MesageID: 37518635 X-Ironport-Server: esa1.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.81,174,1610427600"; d="scan'208";a="37518635" From: Andrew Cooper To: Xen-devel CC: Andrew Cooper , Ian Jackson , Wei Liu , Anthony PERARD Subject: [PATCH 04/10] tools/libxl: Fix uninitialised variable in libxl__domain_get_device_model_uid() Date: Fri, 12 Feb 2021 15:39:47 +0000 Message-ID: <20210212153953.4582-5-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20210212153953.4582-1-andrew.cooper3@citrix.com> References: <20210212153953.4582-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 X-ZohoMail-DKIM: pass (identity @citrix.com) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Various version of gcc, when compiling with -Og, complain: libxl_dm.c: In function 'libxl__domain_get_device_model_uid': libxl_dm.c:256:12: error: 'kill_by_uid' may be used uninitialized in this= function [-Werror=3Dmaybe-uninitialized] 256 | if (kill_by_uid) | ^ The logic is sufficiently complicated I can't figure out if the complain is legitimate or not. There is exactly one path wanting kill_by_uid set to tr= ue, so default it to false and drop the existing workaround for this problem at other optimisation levels. Signed-off-by: Andrew Cooper --- CC: Ian Jackson CC: Wei Liu CC: Anthony PERARD --- tools/libs/light/libxl_dm.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tools/libs/light/libxl_dm.c b/tools/libs/light/libxl_dm.c index 291dee9b3f..1ca21e4b81 100644 --- a/tools/libs/light/libxl_dm.c +++ b/tools/libs/light/libxl_dm.c @@ -128,7 +128,7 @@ static int libxl__domain_get_device_model_uid(libxl__gc= *gc, int rc; char *user; uid_t intended_uid =3D -1; - bool kill_by_uid; + bool kill_by_uid =3D false; =20 /* Only qemu-upstream can run as a different uid */ if (b_info->device_model_version !=3D LIBXL_DEVICE_MODEL_VERSION_QEMU_= XEN) @@ -176,7 +176,6 @@ static int libxl__domain_get_device_model_uid(libxl__gc= *gc, LOGD(DEBUG, guest_domid, "dm_restrict disabled, starting QEMU as root"); user =3D NULL; /* Should already be null, but just in case */ - kill_by_uid =3D false; /* Keep older versions of gcc happy */ rc =3D 0; goto out; } @@ -227,7 +226,6 @@ static int libxl__domain_get_device_model_uid(libxl__gc= *gc, LOGD(WARN, guest_domid, "Could not find user %s, falling back to %= s", LIBXL_QEMU_USER_RANGE_BASE, LIBXL_QEMU_USER_SHARED); intended_uid =3D user_base->pw_uid; - kill_by_uid =3D false; rc =3D 0; goto out; } --=20 2.11.0