From nobody Tue May 7 09:47:03 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=1628247826; cv=none; d=zohomail.com; s=zohoarc; b=WzmDq8QlAZvqVhflA7QnPEnq0RFnGRUQWbDSp1DcTE4HcJpjYaGLCzaDoGpcPPLoZ/6Y2MGn5EN/Libp7qhCJbWBuIBqPdvl2cwb3M/AyP5qfjxBJwalSFP3ZrH13nGGaK36HxHJEP7+7A6ktT/myZbNlf7H0Vp033C8UwBz/w4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1628247826; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=8YiP1wv+4+GxNJYQid0r/a2SNFdQRIp3FcGhXZDHmSM=; b=JfjampMPUlGvCHD8joHlAkOiuTrWbbaeivlkqeo+BsCJ3WmeKKDsL0m9Ram+8IakgMqitPjh8KrQM3jcIm4ZNov+7EoEjgihUCQqDyzJ68+GJjJMuHngjSoAM5O4UdkR2Lsz/SycXYadbFuSaE/FJlPRIfBCA+eMybJ7ENR0Rk4= 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) 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 1628247826953527.5715196884112; Fri, 6 Aug 2021 04:03:46 -0700 (PDT) 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-437-ekxNhlsONcuQbpQRn-cV7w-1; Fri, 06 Aug 2021 07:03:44 -0400 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 C50C960A; Fri, 6 Aug 2021 11:03:37 +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 5906860853; Fri, 6 Aug 2021 11:03:36 +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 26D634BB7B; Fri, 6 Aug 2021 11:03:32 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 176B3Vub017108 for ; Fri, 6 Aug 2021 07:03:31 -0400 Received: by smtp.corp.redhat.com (Postfix) id F3A675F724; Fri, 6 Aug 2021 11:03:30 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.39.194.63]) by smtp.corp.redhat.com (Postfix) with ESMTP id 439805C1A3; Fri, 6 Aug 2021 11:03:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1628247825; 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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=8YiP1wv+4+GxNJYQid0r/a2SNFdQRIp3FcGhXZDHmSM=; b=Ii1dJHyWmt4y4s8lWm2HINStVORX+xFS0MdamKV3CK43a+FBTDu/fSedewpBBm06vuuAIh jsIpKKhlk3pbPLdBiz7C8kDNVWxZp0im2cOn2qRUTTNdggk22pgvI83+lS1JD2AtfIT0J4 A3Aptml2Q2X9XKlSkkjgU4q7DSCtMjw= X-MC-Unique: ekxNhlsONcuQbpQRn-cV7w-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Subject: [PATCH] src: stop checking virIdentityNew return value Date: Fri, 6 Aug 2021 12:03:24 +0100 Message-Id: <20210806110324.3635341-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 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.13 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1628247827920100001 This method will always succeed. Signed-off-by: Daniel P. Berrang=C3=A9 --- src/remote/remote_daemon_dispatch.c | 5 +---- src/rpc/virnetserverclient.c | 5 +---- src/util/viridentity.c | 5 +---- 3 files changed, 3 insertions(+), 12 deletions(-) diff --git a/src/remote/remote_daemon_dispatch.c b/src/remote/remote_daemon= _dispatch.c index 69d0a015ba..0e38b314a2 100644 --- a/src/remote/remote_daemon_dispatch.c +++ b/src/remote/remote_daemon_dispatch.c @@ -2192,7 +2192,7 @@ remoteDispatchConnectSetIdentity(virNetServer *server= G_GNUC_UNUSED, int nparams =3D 0; int rv =3D -1; virConnectPtr conn =3D remoteGetHypervisorConn(client); - g_autoptr(virIdentity) ident =3D NULL; + g_autoptr(virIdentity) ident =3D virIdentityNew(); if (!conn) goto cleanup; =20 @@ -2209,9 +2209,6 @@ remoteDispatchConnectSetIdentity(virNetServer *server= G_GNUC_UNUSED, if (virConnectSetIdentityEnsureACL(conn) < 0) goto cleanup; =20 - if (!(ident =3D virIdentityNew())) - goto cleanup; - if (virIdentitySetParameters(ident, params, nparams) < 0) goto cleanup; =20 diff --git a/src/rpc/virnetserverclient.c b/src/rpc/virnetserverclient.c index 236702ced6..7050430e17 100644 --- a/src/rpc/virnetserverclient.c +++ b/src/rpc/virnetserverclient.c @@ -747,10 +747,7 @@ virNetServerClientCreateIdentity(virNetServerClient *c= lient) g_autofree char *username =3D NULL; g_autofree char *groupname =3D NULL; g_autofree char *seccontext =3D NULL; - g_autoptr(virIdentity) ret =3D NULL; - - if (!(ret =3D virIdentityNew())) - return NULL; + g_autoptr(virIdentity) ret =3D virIdentityNew(); =20 if (client->sock && virNetSocketIsLocal(client->sock)) { gid_t gid; diff --git a/src/util/viridentity.c b/src/util/viridentity.c index c18326c8cb..e36e54ae4b 100644 --- a/src/util/viridentity.c +++ b/src/util/viridentity.c @@ -313,15 +313,12 @@ virIdentity *virIdentityGetSystem(void) g_autofree char *username =3D NULL; g_autofree char *groupname =3D NULL; unsigned long long startTime; - g_autoptr(virIdentity) ret =3D NULL; + g_autoptr(virIdentity) ret =3D virIdentityNew(); #if WITH_SELINUX char *con; #endif g_autofree char *token =3D NULL; =20 - if (!(ret =3D virIdentityNew())) - return NULL; - if (virIdentitySetProcessID(ret, getpid()) < 0) return NULL; =20 --=20 2.31.1