From nobody Fri May 3 03:45:00 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 205.139.110.61 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=1574079528; cv=none; d=zoho.com; s=zohoarc; b=i8vij3qoftO6WOzCbQ9Ffxs3r9nu36gF8vQbGKnZL+S2Y5ZEqyvG8lXDxTaImdNAR++YJuxzx52N7gMduRx/v92IHMikyiHElegpRMwPJ6qoSSoGC2sGTqmRF8JVrWmv8FG2GNacxVjzUkpcY603xaQx5bx3rYQJ8n2/7+pKCaw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1574079528; h=Content-Type:Content-Transfer-Encoding:Cc: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=30qtHfJKSEWBJ07alAFhzKpPJnr2yruwcz62jcF8xTY=; b=IzbNZTBb6xOqj8dlsQFZlNMUoOzkz3gVKYKOvy6V7FOGSgE52MR9w0uGnokeaOg191yo2Aj4pNkmr/O8bYFQ3rgpJAWxE4AjHRVZ/3xkPeCT/nIHhcb+iSF+3tUtnjZlbaZ/r8uq9DqhqtXZkNuuqDduFCEfgZgU7T9zT5ogXXs= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 205.139.110.61 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-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1574079528659638.5056083626737; Mon, 18 Nov 2019 04:18:48 -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-20-yfC0KnN_PtC1p7Fev93BPQ-1; Mon, 18 Nov 2019 07:18:46 -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 3BAA7800587; Mon, 18 Nov 2019 12:18:41 +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 163C019423; Mon, 18 Nov 2019 12:18:41 +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 AC9CC4E562; Mon, 18 Nov 2019 12:18:40 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id xAICIOTm015662 for ; Mon, 18 Nov 2019 07:18:24 -0500 Received: by smtp.corp.redhat.com (Postfix) id 02F4C60905; Mon, 18 Nov 2019 12:18:24 +0000 (UTC) Received: from ridgehead.redhat.com (unknown [10.43.2.116]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5B44E60618; Mon, 18 Nov 2019 12:18:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1574079527; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=30qtHfJKSEWBJ07alAFhzKpPJnr2yruwcz62jcF8xTY=; b=Z82hkEnMVh8jng8w7xVj3kc/Lv4pbh4b2Ktc8TpkNbSj30nVePKa7h6hkUxtS+zrvCHVNM VCUWnuhd0ma6DtcOglVG3Vn70NIgJ/4ytsCn9GmpKf4JTJVwWUVZ4n+0qZ4Ta9LonpJEiT /MGjw+gUJPnjRHbYXwwZ5GGOa5SmlZE= From: Erik Skultety To: libvir-list@redhat.com Date: Mon, 18 Nov 2019 13:18:17 +0100 Message-Id: <93f2b717bb4f915d23ea93e43a827ff24d90649b.1574079462.git.eskultet@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Cc: Erik Skultety Subject: [libvirt] [PATCH 1/3] rpc: gendispatch: Fix a couple of places adding trailing spaces 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 X-MC-Unique: yfC0KnN_PtC1p7Fev93BPQ-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Erik Skultety --- src/rpc/gendispatch.pl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/rpc/gendispatch.pl b/src/rpc/gendispatch.pl index 7c868191d1..8656c8f205 100755 --- a/src/rpc/gendispatch.pl +++ b/src/rpc/gendispatch.pl @@ -1062,7 +1062,7 @@ elsif ($mode eq "server") { print "\n"; =20 print " $conn_type $conn_var =3D $conn_method(client);\n"; - print " if (!$conn_var) \n"; + print " if (!$conn_var)\n"; print " goto cleanup;\n"; print "\n"; =20 @@ -1144,7 +1144,7 @@ elsif ($mode eq "server") { print "\n"; } else { if ($modern_ret_as_list) { - print " if ((nresults =3D \n"; + print " if ((nresults =3D\n"; my $indln =3D " $prefix$call->{ProcName}("; print $indln; print join(",\n" . ' ' x (length $indln), @args_list); --=20 2.23.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 03:45:00 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 205.139.110.61 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=1574079517; cv=none; d=zoho.com; s=zohoarc; b=ET6XW5hb6QcZ34hjE/aRE9q1vXPDiPXcE4yN/ezF561O5DMA3QIAwP8Ki80cgWzEm++D6K3U6C5n5RkRfBZJfnw2Zdtk+mGMDF+leD0b4vkXl+m5tK4xCbSq/85EEG3vchwrAfGlThSmE0jf2P0QOntqpD+xFYT9rAjwPnd87HQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1574079517; h=Content-Type:Content-Transfer-Encoding:Cc: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=xU29Q3yL5SRtch1+8V0V0y4agEGDA4dZT/utpm8ZJrk=; b=GrdPl3VAjiF/GeBxAkbo/vgwXCZ1YTu5wg3YveZ++6gJqp8hhnBLCCoFWhrsL32x9bqoyYj3L+meN1jUSp87JX5GM0NdlyrR6Irrf4vjOanWgXakMPbcZoFk+3MVqG0nOtD+wsnmkAaTwoaVxHtG7+OI2btGmRN8Pn7LtUs1SDs= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 205.139.110.61 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-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1574079517100327.88352497589415; Mon, 18 Nov 2019 04:18: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-100-CHa5W-_3OxeigqUTnXBPmw-1; Mon, 18 Nov 2019 07:18:33 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 92094800580; Mon, 18 Nov 2019 12:18:28 +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 0DEBA60905; Mon, 18 Nov 2019 12:18:27 +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 804A14BB78; Mon, 18 Nov 2019 12:18:25 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id xAICIOL6015671 for ; Mon, 18 Nov 2019 07:18:24 -0500 Received: by smtp.corp.redhat.com (Postfix) id E8C9F60618; Mon, 18 Nov 2019 12:18:24 +0000 (UTC) Received: from ridgehead.redhat.com (unknown [10.43.2.116]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4DBF8608B5; Mon, 18 Nov 2019 12:18:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1574079515; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=xU29Q3yL5SRtch1+8V0V0y4agEGDA4dZT/utpm8ZJrk=; b=bR75mKQyjP3D/PnibBgiyR4DPr1p6xfMoYwswFx+k1OlQhCAg/INU2BkMDih8Z6LXWNtaT mgo0HSUmWdXvav3VaacS79hYJklr6D3a1u21YpGfq/ap/ruZ4Q0h87XcZNDJhajcmBYbBI BqTx/jwW+bEe+iv+y/dqoWjZe6BVKN8= From: Erik Skultety To: libvir-list@redhat.com Date: Mon, 18 Nov 2019 13:18:18 +0100 Message-Id: <5ed8eee069541127a0a72fb512b90b2243a6d92d.1574079462.git.eskultet@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Cc: Erik Skultety Subject: [libvirt] [PATCH 2/3] rpc: gendispatch: Add a check for zero size client-side buffers 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.13 X-MC-Unique: CHa5W-_3OxeigqUTnXBPmw-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" After libvirt switched to GLib, we also started to use glib allocation primitives as of commit e85e34f3. Unlike malloc which is ambiguous with regards to size =3D=3D 0 (which in our case returned a unique pointer safe to be passed to free), g_malloc0 strictly returns NULL on size =3D=3D 0. This change broke our legacy APIs which rely on the caller to pre-allocate the target buffer to hold the results and pass the buffer size as an argument. Since it makes very little sense to call an API with nowhere to store the results, fix this by returning 0 directly in such case in the RPC dispatch code - there are modern API equivalents allocating the target buffer automatically anyway. https://bugzilla.redhat.com/show_bug.cgi?id=3D1772842 Signed-off-by: Erik Skultety --- src/rpc/gendispatch.pl | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/rpc/gendispatch.pl b/src/rpc/gendispatch.pl index 8656c8f205..524d31f741 100755 --- a/src/rpc/gendispatch.pl +++ b/src/rpc/gendispatch.pl @@ -1073,6 +1073,14 @@ elsif ($mode eq "server") { print " goto cleanup;\n"; print " }\n"; print "\n"; + + + print " if (args->$single_ret_list_max_var =3D=3D 0) {\n"; + print " ret->$single_ret_list_name.${single_ret_list_na= me}_len =3D 0;\n"; + print " rv =3D 0;\n"; + print " goto cleanup;\n"; + print " }\n"; + print "\n"; } =20 print join("\n", @getters_list); --=20 2.23.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 03:45:00 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 207.211.31.120 as permitted sender) client-ip=207.211.31.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 207.211.31.120 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=1574079534; cv=none; d=zoho.com; s=zohoarc; b=QbsgKF0DtwcSXFf8GtJEJxxLn5S5vldTiEa0STEXrtccftRgzBCEG03FSiiIbfD9thYk7MmFFYrQVsMAMAN79gw/8I2u0OdLL2ZQqSWecPVUluL6/TQzlAJDyLEIx/Vlmf8Xj7OZUlUjlcHqlX7gg/q3q7TzY+m7sarTnVu1zo8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1574079534; h=Content-Type:Content-Transfer-Encoding:Cc: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=rtY9mKq67Kq4NA3VCaUWp9arkq//ue0RaODU5Ni8wsY=; b=bo1kkaODM8iro5dbOiaeQte0jbS4YCnvXGOWSzKu1aYehOsrh7/irv/8RyOeyej4PY3T0LMlmEJjNMXH2Qq1dte9sGQUTxXT+9siNK5YpcPuk+0ahmSS0wAl7EoJewXnRZ3uOu/D2N/WlsPnPqhPdS8zBz2q+BgJIAABePaDb+A= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 207.211.31.120 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-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by mx.zohomail.com with SMTPS id 1574079534425218.56091147524637; Mon, 18 Nov 2019 04:18:54 -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-69-vDAwd8xmM_aNPaTnwOm98g-1; Mon, 18 Nov 2019 07:18:50 -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 AD56B800584; Mon, 18 Nov 2019 12:18:44 +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 80EB95E248; Mon, 18 Nov 2019 12:18:44 +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 3F5C418089CD; Mon, 18 Nov 2019 12:18:44 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id xAICIPwl015678 for ; Mon, 18 Nov 2019 07:18:25 -0500 Received: by smtp.corp.redhat.com (Postfix) id DD4A760D0B; Mon, 18 Nov 2019 12:18:25 +0000 (UTC) Received: from ridgehead.redhat.com (unknown [10.43.2.116]) by smtp.corp.redhat.com (Postfix) with ESMTP id 40142608B5; Mon, 18 Nov 2019 12:18:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1574079533; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=rtY9mKq67Kq4NA3VCaUWp9arkq//ue0RaODU5Ni8wsY=; b=gWnH2HBmZTj4q1K5SioEd4iIUdCrzBxYrmMkUvrY7CVGr8282AxxLJH0aTM4JOK73J6sE8 BsHQuj06bEO6j1JVMeEt1HZJMlVwxzXCy6VIU9faFbKIWdK4C1PHBsvxtgzz07PXacpMSr 86qKYQ+MdtpeYe5bOeO+IZOCqSpqsDk= From: Erik Skultety To: libvir-list@redhat.com Date: Mon, 18 Nov 2019 13:18:19 +0100 Message-Id: <95f1ed434065c8e562ba097b9acbd29f6543f049.1574079462.git.eskultet@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Cc: Erik Skultety Subject: [libvirt] [PATCH 3/3] libvirt-domain: virConnectListDomains: Return 0 on zero-size buffer 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 X-MC-Unique: vDAwd8xmM_aNPaTnwOm98g-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" It doesn't make sense to pass a target buffer into an API, declaring its size as 0 and expect some meaningful result. Since this used to work pre-Glib era, we shouldn't end with an error, but we can return 0 for the number of domains immediately, instead of calling into the daemon, which is exactly what the daemon would have returned anyway. Signed-off-by: Erik Skultety --- src/libvirt-domain.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c index 02622cb2ca..0def40fdf7 100644 --- a/src/libvirt-domain.c +++ b/src/libvirt-domain.c @@ -62,6 +62,9 @@ virConnectListDomains(virConnectPtr conn, int *ids, int m= axids) virCheckNonNullArgGoto(ids, error); virCheckNonNegativeArgGoto(maxids, error); =20 + if (maxids =3D=3D 0) + return 0; + if (conn->driver->connectListDomains) { int ret =3D conn->driver->connectListDomains(conn, ids, maxids); if (ret < 0) --=20 2.23.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list