From nobody Fri Mar 17 10:29:26 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PdL3C0sLDz3yBby; Fri, 17 Mar 2023 10:29:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PdL3C0RKqz3Gnk; Fri, 17 Mar 2023 10:29:27 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679048967; h=from:from: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; bh=Mn9ST0CFDnroeWhaYB17XIeSUd3ay4KXz6tYIXuCuP4=; b=eC8PJeT72LhvbAyIh2nJfIGl/F00gVVBT81383PetIhi7HpAbnizWz9aal3Wtkyw3qKQis t1D+g9sM2O+ANmb/A8QmARnXRzvyqRHuEFfb9tW1aSC1sJUzxhrJBU2St2KMtUwd/57cSb 25ODtYgCRwTEB9g2VblVTOgiLv8mDcM+EcqhstV3u+dYehvh044JIk5is7DeCEsIODXZ2w 7Csffw+QA+Cm2Fd9ghcYweHc55fozUnmEVk2l/OxLZaeoBRgs6a4yxqmm8sfEIsmGLifL0 JR/lKIrisatd20Ao0Kyj0EQQRpEbCa0jF1GAftsYKFeARgDn3TqzuSOMHt6ozw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679048967; h=from:from: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; bh=Mn9ST0CFDnroeWhaYB17XIeSUd3ay4KXz6tYIXuCuP4=; b=GQvsXdpI7kQ6uK6L2wHJFcHj0y8WlFSouUVhLNESuELswbtorTrIPiBzwyphyPdxnZ92Vk bh1Qa+OVsNAguJT8rhBNyg8p/rNSIo/hbrtbT/L556dHQKpfxdv1r4BBJMT410/TulGOsN 8YKaLSY1LqsGlH2D93gld0Gcm0M70EBKbkuRIoHyCmAFCOBP2F4k19rDIcS1Sm4mm8+GbU vIlxeRygJQ4w6aamcsoBELWR7nqnAhTcLd11Vqihnv1NoTG/Ufbrkif1ak+9SNecBITrYc oKWygR875z9Lj53ZXGrrpCd9XW9mFw7xaigT4t26IWahDUu0QYP27I120nHT2w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679048967; a=rsa-sha256; cv=none; b=O95IhpxynDHAqHyrEe7VS4JJKa19Yz/B7W97JOCwVd8NOHO3KaQ4DQyo83E6885gxrECSh 3Ci5d8AKyLAxqvUCWTbDb13KzudS5guuKZP3GRIsoecBf8M2kyo4AUK4RQHt4VMaKSxZch 26k0O4a3UK/ZosO79WYgdvy277Y7EgN71Wl8MB6l+Bd1byH2NPq481SJhKouIusMi650c1 zzufat+X4SRFmd1/9fgKVUR9Od2vSNu0Mko6p3bIqHF9ipMbkYzyqKbYBV6nyPjtkswPLI q5VHBEM8WadmFq/YBctnXa82MJg8nhKAo6I3l5BTpebfWOtVtzAEoN6dsSFduw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PdL3B6RsWzM6n; Fri, 17 Mar 2023 10:29:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 32HATQSN067381; Fri, 17 Mar 2023 10:29:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32HATQHU067380; Fri, 17 Mar 2023 10:29:26 GMT (envelope-from git) Date: Fri, 17 Mar 2023 10:29:26 GMT Message-Id: <202303171029.32HATQHU067380@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: =?utf-8?Q?Corvin=20K=C3=B6hne?= Subject: git: 38b37099bb19 - stable/13 - bhyvectl: do not return garbage from send_message List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: corvink X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 38b37099bb198128b309c08cf4583efd21e72f72 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by corvink: URL: https://cgit.FreeBSD.org/src/commit/?id=38b37099bb198128b309c08cf4583efd21e72f72 commit 38b37099bb198128b309c08cf4583efd21e72f72 Author: Vitaliy Gusev AuthorDate: 2023-03-06 11:27:10 +0000 Commit: Corvin Köhne CommitDate: 2023-03-17 10:26:33 +0000 bhyvectl: do not return garbage from send_message err is used uninitialized in some cases. Reviewed by: corvink, markj MFC after: 1 week Sponsored by: vStack Differential Revision: https://reviews.freebsd.org/D38886 (cherry picked from commit 89fe7b98fe45cf56d60d0d4dfa1bfad3ba6908ec) --- usr.sbin/bhyvectl/bhyvectl.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/usr.sbin/bhyvectl/bhyvectl.c b/usr.sbin/bhyvectl/bhyvectl.c index cab1e6d72c56..5efccc085119 100644 --- a/usr.sbin/bhyvectl/bhyvectl.c +++ b/usr.sbin/bhyvectl/bhyvectl.c @@ -1679,12 +1679,12 @@ static int send_message(const char *vmname, nvlist_t *nvl) { struct sockaddr_un addr; - int err, socket_fd; + int err = 0, socket_fd; socket_fd = socket(PF_UNIX, SOCK_STREAM, 0); if (socket_fd < 0) { perror("Error creating bhyvectl socket"); - err = -1; + err = errno; goto done; } @@ -1700,8 +1700,10 @@ send_message(const char *vmname, nvlist_t *nvl) goto done; } - if (nvlist_send(socket_fd, nvl) < 0) + if (nvlist_send(socket_fd, nvl) < 0) { perror("nvlist_send() failed"); + err = errno; + } nvlist_destroy(nvl); done: