From nobody Mon Feb 9 02:51:53 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.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.129.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=1674490161; cv=none; d=zohomail.com; s=zohoarc; b=AxxT+mOjmic2Rv1lNmuAyKLG+mHKS+kFlvmD2xDckw+NklSLTkxhJ44DsgZFKKPF7SI03xDG+K8ojcUtwUP+pVVv+Sb8qTrktzs1LbpLqZyooGLW748Bn7JEoRUR+VWktVYnCAcq7A3juCS8X8PP5TIIbS7f4WE01NzJkYWMezA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1674490161; 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=fi2L3jSKixgHFHrQYPN0INvCJWGc1bto2u7dia8v744=; b=G+PAimPDJRLQrx2tRv7bSS/zm2mUKwQfKi0UkLktdfp2TJ/pyuVIaQ2k1Q2ADm2v2oXmfqqfsqep2G78SGbZoosrA/lMUU2AbPd3w6a0mWxIKR0jH5yAyGGGk0VwZi+POEBVlZgUo6s0LirdTQyl/+ewqZsPNSnFeL2u9FO9EFk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.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.129.124]) by mx.zohomail.com with SMTPS id 1674490161891816.980166980474; Mon, 23 Jan 2023 08:09:21 -0800 (PST) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-41-RCsOvLlrOpyhUf1qQ7bVog-1; Mon, 23 Jan 2023 11:09:15 -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 7D86285C06B; Mon, 23 Jan 2023 16:09:08 +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 68DCB111E3E6; Mon, 23 Jan 2023 16:09:08 +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 3520B194658D; Mon, 23 Jan 2023 16:09:08 +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 BB6F5194658C for ; Mon, 23 Jan 2023 16:09:06 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 916B840C2008; Mon, 23 Jan 2023 16:09:06 +0000 (UTC) Received: from speedmetal.lan (ovpn-208-29.brq.redhat.com [10.40.208.29]) by smtp.corp.redhat.com (Postfix) with ESMTP id A2AFE40C2004 for ; Mon, 23 Jan 2023 16:09:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1674490160; 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=fi2L3jSKixgHFHrQYPN0INvCJWGc1bto2u7dia8v744=; b=V1xA7ToUmMuEZQN/TVoPOojU/kAYICrRA5qWtpIfOR9uBnv+Vf/sMh2UL0dGWe6eg1R4cO 4v5fibbBXKVDD9RWDMEK07dbKNN0f9yT9McazipOCMZFsABSyWQZk5tZVJxE9ytIX677ec VcZ9seDENS1rfnpyUeY/bmlF0X2URus= X-MC-Unique: RCsOvLlrOpyhUf1qQ7bVog-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 5/5] virnetlibsshsession: Don't check return value of 'virNetLibsshSessionAuthMethodNew' Date: Mon, 23 Jan 2023 17:08:55 +0100 Message-Id: In-Reply-To: References: 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-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1674490162789100001 Content-Type: text/plain; charset="utf-8" The function can't return NULL to the callers so it doesn't make sense to check it. Signed-off-by: Peter Krempa --- src/rpc/virnetlibsshsession.c | 43 ++++++----------------------------- 1 file changed, 7 insertions(+), 36 deletions(-) diff --git a/src/rpc/virnetlibsshsession.c b/src/rpc/virnetlibsshsession.c index d2e9e20ff2..bba37210df 100644 --- a/src/rpc/virnetlibsshsession.c +++ b/src/rpc/virnetlibsshsession.c @@ -843,7 +843,6 @@ int virNetLibsshSessionAuthAddPasswordAuth(virNetLibsshSession *sess, virURI *uri) { - int ret; virNetLibsshAuthMethod *auth; virObjectLock(sess); @@ -857,43 +856,27 @@ virNetLibsshSessionAuthAddPasswordAuth(virNetLibsshSe= ssion *sess, } } - - if (!(auth =3D virNetLibsshSessionAuthMethodNew(sess))) { - ret =3D -1; - goto cleanup; - } - + auth =3D virNetLibsshSessionAuthMethodNew(sess); auth->method =3D VIR_NET_LIBSSH_AUTH_PASSWORD; auth->ssh_flags =3D SSH_AUTH_METHOD_PASSWORD; - ret =3D 0; - - cleanup: virObjectUnlock(sess); - return ret; + return 0; } int virNetLibsshSessionAuthAddAgentAuth(virNetLibsshSession *sess) { - int ret; virNetLibsshAuthMethod *auth; virObjectLock(sess); - if (!(auth =3D virNetLibsshSessionAuthMethodNew(sess))) { - ret =3D -1; - goto cleanup; - } - + auth =3D virNetLibsshSessionAuthMethodNew(sess); auth->method =3D VIR_NET_LIBSSH_AUTH_AGENT; auth->ssh_flags =3D SSH_AUTH_METHOD_PUBLICKEY; - ret =3D 0; - - cleanup: virObjectUnlock(sess); - return ret; + return 0; } int @@ -910,11 +893,7 @@ virNetLibsshSessionAuthAddPrivKeyAuth(virNetLibsshSess= ion *sess, virObjectLock(sess); - if (!(auth =3D virNetLibsshSessionAuthMethodNew(sess))) { - virObjectUnlock(sess); - return -1; - } - + auth =3D virNetLibsshSessionAuthMethodNew(sess); auth->filename =3D g_strdup(keyfile); auth->method =3D VIR_NET_LIBSSH_AUTH_PRIVKEY; auth->ssh_flags =3D SSH_AUTH_METHOD_PUBLICKEY; @@ -927,26 +906,18 @@ int virNetLibsshSessionAuthAddKeyboardAuth(virNetLibsshSession *sess, int tries) { - int ret; virNetLibsshAuthMethod *auth; virObjectLock(sess); - if (!(auth =3D virNetLibsshSessionAuthMethodNew(sess))) { - ret =3D -1; - goto cleanup; - } + auth =3D virNetLibsshSessionAuthMethodNew(sess); auth->tries =3D tries; auth->method =3D VIR_NET_LIBSSH_AUTH_KEYBOARD_INTERACTIVE; auth->ssh_flags =3D SSH_AUTH_METHOD_INTERACTIVE; - ret =3D 0; - - cleanup: virObjectUnlock(sess); - return ret; - + return 0; } void --=20 2.38.1