From nobody Tue May 14 01:44:34 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1608153203; cv=none; d=zohomail.com; s=zohoarc; b=iV9XFWj8+5b2ip8uD1WZyX52iGrxQ+ZcD1g9q68PJDrAe+77XkF66UDPnXuUQzR+H4iJbjmcWg8Il/MrErGVNcaiKnXJZlCVuhFYRdbmiQet7U9/RzmKrOwxlKl+vGnwZxCLKhIC4K9H/3VAYzf7XsDnruFrny7FPad2uk+Juqc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1608153203; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=fSy1w3gzRTSJxOY1VCFswCjw4PojxkVFJMF+wVxRUko=; b=YFq6CBLZ9gzLvg2DOk0ZTU4ozv63FhxCeSi9RKMjR+jE5vQ8xaHC8FEm6qaIhzccyM6Nl5xweEy3S8U1VDWAO/Pnv9hngFg4S0fBQzxMZkGd5s7LOsJT0ROYfqsZSAjSzI9W3BIoV5g86WnBUqSPFFOYY506rH11d8rjlpbCLPc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1608153203128268.0393444418289; Wed, 16 Dec 2020 13:13:23 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-75-7NfDzQEUOYeJxzy6R5ZhYA-1; Wed, 16 Dec 2020 16:13:19 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 240F2802B40; Wed, 16 Dec 2020 21:13:13 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C202F5D722; Wed, 16 Dec 2020 21:13:12 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id DDF314BB40; Wed, 16 Dec 2020 21:13:08 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0BGLD7eu005917 for ; Wed, 16 Dec 2020 16:13:07 -0500 Received: by smtp.corp.redhat.com (Postfix) id B90FA17CFE; Wed, 16 Dec 2020 21:13:07 +0000 (UTC) Received: from localhost.localdomain (unknown [10.40.193.177]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3AED41971D for ; Wed, 16 Dec 2020 21:13:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1608153202; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=fSy1w3gzRTSJxOY1VCFswCjw4PojxkVFJMF+wVxRUko=; b=YhsTUDe+F0PNRVBbOwnEeswF46tcp70c1AbwmJADe0pFOKdsmR+8JCgjyT7xxuN3I6XxxV zldS7NTI48ARFoYpBw1N+17tEDldFWQINAFI+lHLaeFlmfFT06d+LLFqMfW8gqL1SFB+rt 2u1ek5bIOtglkpAwSwsSxjIfIY6sdM8= X-MC-Unique: 7NfDzQEUOYeJxzy6R5ZhYA-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 1/4] schema: Allow lxc:namepsace children to appear individually Date: Wed, 16 Dec 2020 22:12:58 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Since its introduction in v1.2.19-rc1~8 our schema mandates that LXC domain namespace child elements appear either all three at once or not at all: This is not mandated by our parser though. Neither by code that later uses it (virLXCProcessSetupNamespaces()). Relax the schema. Signed-off-by: Michal Privoznik Reviewed-by: Laine Stump --- docs/schemas/domaincommon.rng | 66 +++++++++++++++++++---------------- 1 file changed, 36 insertions(+), 30 deletions(-) diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 795b654feb..17e25f14f2 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -6821,36 +6821,42 @@ --> - - - - - netns - name - pid - - - - - - - - name - pid - - - - - - - - name - pid - - - - - + + + + + + netns + name + pid + + + + + + + + + + name + pid + + + + + + + + + + name + pid + + + + + + =20 --=20 2.26.2 From nobody Tue May 14 01:44:34 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1608153215; cv=none; d=zohomail.com; s=zohoarc; b=k4Mcl2IYIVbxbe33aZOEwDJN0WjTdrzk44zqGZuE8DOe8J6uMHtD+R2YDHHLeXMO85xU6K7yS7ZPiiCndQcjyvBQ/j57nv7LOgZOL55HHwRdsf8qTJCDmF3pWzMcdJS7vok+VsSglEaOrtgn9pq1ClszB4RmoW9jstMkZ1WQgQQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1608153215; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=5h91A7uIO9Gb2oIpENyGbsgdSYcMtAdZyOvmkiUBcCI=; b=SassncR/tGpymJCd6PuC5e7gkTQO6+GRnfNl0BzB/jtK6BiFdsY1MS98DKZ3BVexj7s8nnhUIPzXboozUywxrKG0O9AzBac2Z7a9S2yP68WUwLQfybS2yJ5bYWe/K341zjfp/Mr8axcDrtv3KTwBZCMQTkBONO0nwwMQCd1exdM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1608153214961676.8798139132609; Wed, 16 Dec 2020 13:13:34 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-464-LWHaiKh6Pbu5VCfJxmmj6A-1; Wed, 16 Dec 2020 16:13:30 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C3071800D53; Wed, 16 Dec 2020 21:13:24 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A010560BF3; Wed, 16 Dec 2020 21:13:24 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 682031809CA2; Wed, 16 Dec 2020 21:13:24 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0BGLD8vj005924 for ; Wed, 16 Dec 2020 16:13:08 -0500 Received: by smtp.corp.redhat.com (Postfix) id 975ED1F4; Wed, 16 Dec 2020 21:13:08 +0000 (UTC) Received: from localhost.localdomain (unknown [10.40.193.177]) by smtp.corp.redhat.com (Postfix) with ESMTP id 193241971D for ; Wed, 16 Dec 2020 21:13:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1608153212; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=5h91A7uIO9Gb2oIpENyGbsgdSYcMtAdZyOvmkiUBcCI=; b=T70uubvWYEF6A+Aua5j9KIpQPAdm62hyVezZXp+2Z9LV02uRbDi9+V+o3rhdhLty8Amo56 GF0WbtP+7xrAcHvUM4F6yxBk5ITaiv8kAR8oydwHkAKVy2K/M8pk1Z85s5t3qnSdv+fCQZ fHwYzAXWB+m/k3Gr7OhQXGGK1EtZjDo= X-MC-Unique: LWHaiKh6Pbu5VCfJxmmj6A-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 2/4] lxc: Allow NULL argument to lxcDomainDefNamespaceFree() Date: Wed, 16 Dec 2020 22:12:59 +0100 Message-Id: <495e1b75ea507f6f105def5136710875e8e6b9ac.1608153074.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" As all other free functions, NULL should be accepted. Even though there currently is no caller that would pass NULL, there will be in future patches. Signed-off-by: Michal Privoznik Reviewed-by: Laine Stump --- src/lxc/lxc_domain.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/lxc/lxc_domain.c b/src/lxc/lxc_domain.c index df60519fca..707262336b 100644 --- a/src/lxc/lxc_domain.c +++ b/src/lxc/lxc_domain.c @@ -195,6 +195,10 @@ lxcDomainDefNamespaceFree(void *nsdata) { size_t i; lxcDomainDefPtr lxcDef =3D nsdata; + + if (!lxcDef) + return; + for (i =3D 0; i < VIR_LXC_DOMAIN_NAMESPACE_LAST; i++) g_free(lxcDef->ns_val[i]); g_free(nsdata); --=20 2.26.2 From nobody Tue May 14 01:44:34 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1608153217; cv=none; d=zohomail.com; s=zohoarc; b=luig5mtM1o2Ehvn1J6/XLBsG79wXMoN1ZeSi51BgSwwvaz2AJKu6CIrivWCDV8t0r6MOHB2LeunUXwVMDjdnhNl9tHZqlHdE1n8dMJ0gcU2EsgpCXZ+hT12RA7iileaunzzqstFy0/Jnjr9UloWy8Q8FuXW6ZtFQrMuVw9IGZic= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1608153217; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=isfvCwdh5Sl2X6gnloTtROwpQB0rpIfCw8AIBiNbOIQ=; b=atatnWaLVyz3tRzE8kMdph3w4Mu0j0PQTcPwjND+7a9+bXCuuptEbAigJdifbI/wi/9cSV0URmeNUOqkI/62FXU7drAmwHvKmysu/8WDa9gMLmZYRn4P29Khm4munepIxlORl8qEt+ck8CZAPyep+yhifirnyHkDrb3O124Qh2Y= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1608153217224901.6061839807252; Wed, 16 Dec 2020 13:13:37 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-510-BAE2m0_GPDGgmbCCQiysbw-1; Wed, 16 Dec 2020 16:13:19 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3E875801817; Wed, 16 Dec 2020 21:13:14 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0AF3A27C4F; Wed, 16 Dec 2020 21:13:14 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id C171A180954D; Wed, 16 Dec 2020 21:13:11 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0BGLD97k005937 for ; Wed, 16 Dec 2020 16:13:09 -0500 Received: by smtp.corp.redhat.com (Postfix) id 752DE1F4; Wed, 16 Dec 2020 21:13:09 +0000 (UTC) Received: from localhost.localdomain (unknown [10.40.193.177]) by smtp.corp.redhat.com (Postfix) with ESMTP id E9D141971D for ; Wed, 16 Dec 2020 21:13:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1608153203; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=isfvCwdh5Sl2X6gnloTtROwpQB0rpIfCw8AIBiNbOIQ=; b=Aq0xr/AFb9/cMYl/TAT2874ks2BERxTeikV7/g0nGG6HKOw/z8Bcii/P44x1XaFVnZAAji JoeUcHqgW4E3GNIfIsuaEsjFCbhgxLYwRL9SoLEBf53Mq1+d+gIXnia69g5Uz0dh7MDlJx lwHV2/6Nl4+xOOUAJCoRQ2dxRg7qwPU= X-MC-Unique: BAE2m0_GPDGgmbCCQiysbw-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 3/4] lxc: Rework lxcDomainDefNamespaceParse() Date: Wed, 16 Dec 2020 22:13:00 +0100 Message-Id: <3c4ef431e08c0674dd90ae9dc64235f366e951a6.1608153074.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" While fixing our schema for I've looked into the parser and realized it could use some treating. Signed-off-by: Michal Privoznik Reviewed-by: Laine Stump --- src/lxc/lxc_domain.c | 40 ++++++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/src/lxc/lxc_domain.c b/src/lxc/lxc_domain.c index 707262336b..255bfab495 100644 --- a/src/lxc/lxc_domain.c +++ b/src/lxc/lxc_domain.c @@ -208,26 +208,31 @@ static int lxcDomainDefNamespaceParse(xmlXPathContextPtr ctxt, void **data) { - lxcDomainDefPtr lxcDef =3D g_new0(lxcDomainDef, 1); + lxcDomainDefPtr lxcDef =3D NULL; g_autofree xmlNodePtr *nodes =3D NULL; - bool uses_lxc_ns =3D false; VIR_XPATH_NODE_AUTORESTORE(ctxt) - int feature; int n; size_t i; + int ret =3D -1; =20 if ((n =3D virXPathNodeSet("./lxc:namespace/*", ctxt, &nodes)) < 0) - goto error; - uses_lxc_ns |=3D n > 0; + return -1; + + if (n =3D=3D 0) + return 0; + + lxcDef =3D g_new0(lxcDomainDef, 1); =20 for (i =3D 0; i < n; i++) { g_autofree char *tmp =3D NULL; + int feature; + if ((feature =3D virLXCDomainNamespaceTypeFromString( (const char *)nodes[i]->name)) < 0) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("unsupported Namespace feature: %s"), - nodes[i]->name); - goto error; + _("unsupported Namespace feature: %s"), + nodes[i]->name); + goto cleanup; } =20 ctxt->node =3D nodes[i]; @@ -235,31 +240,30 @@ lxcDomainDefNamespaceParse(xmlXPathContextPtr ctxt, if (!(tmp =3D virXMLPropString(nodes[i], "type"))) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("No lxc environment type specified")); - goto error; + goto cleanup; } if ((lxcDef->ns_source[feature] =3D virLXCDomainNamespaceSourceTypeFromString(tmp)) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Unknown LXC namespace source '%s'"), tmp); - goto error; + goto cleanup; } =20 if (!(lxcDef->ns_val[feature] =3D virXMLPropString(nodes[i], "value"))) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("No lxc environment type specified")); - goto error; + goto cleanup; } } - if (uses_lxc_ns) - *data =3D lxcDef; - else - g_free(lxcDef); - return 0; - error: + + *data =3D g_steal_pointer(&lxcDef); + ret =3D 0; + + cleanup: lxcDomainDefNamespaceFree(lxcDef); - return -1; + return ret; } =20 =20 --=20 2.26.2 From nobody Tue May 14 01:44:34 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1608153216; cv=none; d=zohomail.com; s=zohoarc; b=VsLPHkawQKKQ4XfrzasRwM8U+fdrEMnsn39ikQbOGyWBllfsG9OP26AHVqTnl7iEbor7ROR8DMsHNOhbQwUxWhhK8GBk9KDdmOeWfZ6TGAXuQKWTkDoPui2clkp9vrkpQlyNsC7+WGpIbh6YK4FZwYvz+lWu2LrMJntNmxU2Bb0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1608153216; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=BhnQyV0its/RPH1P/2JywhenRH1ib4swslFaha6BKc8=; b=d6pdye/HAGoqZfnXNEs5LI2RgY9GJK1qCKWSVJdivMVN5l/lFmV/5JdS3423l3jpPX+E9d2oymxOeMEXj6IF5S4QD6bP1tymbdJMfRCCKahOlT1lTwHIXILeqyklgz3ohNPbRlGsVEN71CmsbttDnOZ/Xk3sRr7+aXU/kDKWo9s= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1608153215908969.3210602307723; Wed, 16 Dec 2020 13:13:35 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-177-baL1erbLMbmFdy7Txe94lA-1; Wed, 16 Dec 2020 16:13:31 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C04CD107ACFA; Wed, 16 Dec 2020 21:13:24 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9DDFB5D9D5; Wed, 16 Dec 2020 21:13:24 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 65E395002E; Wed, 16 Dec 2020 21:13:24 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0BGLDAxe005944 for ; Wed, 16 Dec 2020 16:13:10 -0500 Received: by smtp.corp.redhat.com (Postfix) id 511AA1971D; Wed, 16 Dec 2020 21:13:10 +0000 (UTC) Received: from localhost.localdomain (unknown [10.40.193.177]) by smtp.corp.redhat.com (Postfix) with ESMTP id C73311F4 for ; Wed, 16 Dec 2020 21:13:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1608153214; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=BhnQyV0its/RPH1P/2JywhenRH1ib4swslFaha6BKc8=; b=D4rHHzjfsAKvKoNWSRIa3NAjjw4BZtiaeLQkqvliyNWxz/wNXbXYraW3CltAFRqg7PhGa1 QfyQIyZOa9mG/CdIDu68et01zUB3OstPkOHnNwKu6EflMnZyIJs4ZdZ5oIBEDMRxSbiBlI vnwt+f0ZdBnyS8niruImOhfgGUm+nuI= X-MC-Unique: baL1erbLMbmFdy7Txe94lA-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 4/4] lxd_domain: Require that VIR_LXC_DOMAIN_NAMESPACE_SOURCE_NONE is zero Date: Wed, 16 Dec 2020 22:13:01 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Our parser code relies on the fact that VIR_LXC_DOMAIN_NAMESPACE_SOURCE_NONE has value of zero and thus uses g_new0(). But strictly speaking, this is not mandated by the enum typedef. Fix that. Signed-off-by: Michal Privoznik Reviewed-by: Laine Stump --- src/lxc/lxc_domain.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lxc/lxc_domain.h b/src/lxc/lxc_domain.h index 319f83338f..3b5adcbe1c 100644 --- a/src/lxc/lxc_domain.h +++ b/src/lxc/lxc_domain.h @@ -35,7 +35,7 @@ typedef enum { } virLXCDomainNamespace; =20 typedef enum { - VIR_LXC_DOMAIN_NAMESPACE_SOURCE_NONE, + VIR_LXC_DOMAIN_NAMESPACE_SOURCE_NONE =3D 0, VIR_LXC_DOMAIN_NAMESPACE_SOURCE_NAME, VIR_LXC_DOMAIN_NAMESPACE_SOURCE_PID, VIR_LXC_DOMAIN_NAMESPACE_SOURCE_NETNS, --=20 2.26.2