From nobody Tue Feb 10 06:05:08 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.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 170.10.133.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=1673358904; cv=none; d=zohomail.com; s=zohoarc; b=BzD3s4Fm88NHmhPWj7XbdWQVkYNLyUfUyEb2I8r5bxPcWXww6gitoDJ80uFycYhhTQO1sqDa/8894onIVpiXlb175I8sT6tOmWKE4Cx7xcVmZCvY+Im23R0UCAwxIkbShiwb/jEEW4Abwweqe962wg4IQAEwjQMiI5huV+QSmJk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1673358904; 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=kBw86mQnEgonPTMbqk3726zIVefNGleyFnbjq4jObkI=; b=mzgdP0tnrxxR8cYO4YDJK1a3hC2rBQYWB5OtPfPigy36sddU5AxGRC/6N0Oa9LTgjGDwsifuX/607amIrhk6qF2o1RDgostNIhYSGZP9KPrpRW3obZwdKrrqbnUT9KFGYQ8AlQ26tzzAneZ1Zqkb597oXR8iiCCLGnvAvgKQxWg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1673358904475689.3590546103089; Tue, 10 Jan 2023 05:55:04 -0800 (PST) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-194-J5LWmItiOq28F5xUTIJGxQ-1; Tue, 10 Jan 2023 08:54:34 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E4DB8280BCA1; Tue, 10 Jan 2023 13:54:28 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id CFB0D112131B; Tue, 10 Jan 2023 13:54:28 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 8EB53194E11B; Tue, 10 Jan 2023 13:54:28 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 32B55194E101 for ; Tue, 10 Jan 2023 13:54:25 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 263A640C2064; Tue, 10 Jan 2023 13:54:25 +0000 (UTC) Received: from virtlab420.virt.lab.eng.bos.redhat.com (virtlab420.virt.lab.eng.bos.redhat.com [10.19.152.148]) by smtp.corp.redhat.com (Postfix) with ESMTP id CB56340C2004; Tue, 10 Jan 2023 13:54:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1673358903; 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=kBw86mQnEgonPTMbqk3726zIVefNGleyFnbjq4jObkI=; b=OhJAYEOGpMwua3lpcd23Pdj6GdHN4zO+eW39fsmk7JDPTiBstQDEYGcCS2HpWCR3LE77dY izrs6FfYzWPSmTL9uetqUFBqdjA5en649IZjYfrZznJC3fhoV/uS2J4jB1GtmnDjUooK8j 9lesjqEh329Xv5nlb0dMQdzWCABNJxo= X-MC-Unique: J5LWmItiOq28F5xUTIJGxQ-1 X-Original-To: libvir-list@listman.corp.redhat.com From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Subject: [libvirt PATCH 7/9] rpc: use struct zero initializer instead of memset Date: Tue, 10 Jan 2023 08:54:21 -0500 Message-Id: <20230110135423.2576907-8-berrange@redhat.com> In-Reply-To: <20230110135423.2576907-1-berrange@redhat.com> References: <20230110135423.2576907-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1673358904695100001 This is a more concise approach and guarantees there is no time window where the struct is uninitialized. Signed-off-by: Daniel P. Berrang=C3=A9 --- src/rpc/gendispatch.pl | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/rpc/gendispatch.pl b/src/rpc/gendispatch.pl index 63d2411474..e9dc8e27d7 100755 --- a/src/rpc/gendispatch.pl +++ b/src/rpc/gendispatch.pl @@ -1534,7 +1534,7 @@ elsif ($mode eq "client") { if ($rettype eq "void") { $call_ret =3D "NULL"; } else { - push(@vars_list, "$rettype ret"); + push(@vars_list, "$rettype ret =3D {0}"); =20 foreach my $ret_member (@{$call->{ret_members}}) { if ($multi_ret) { @@ -1891,11 +1891,6 @@ elsif ($mode eq "client") { print "\n"; } =20 - if ($rettype ne "void") { - print "\n"; - print " memset(&ret, 0, sizeof(ret));\n"; - } - my $callflags =3D "0"; if ($structprefix eq "qemu") { $callflags =3D "REMOTE_CALL_QEMU"; --=20 2.38.1