From nobody Mon Mar 06 13:05:24 2023 X-Original-To: dev-commits-src-main@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 4PVf2D41tPz3wspJ; Mon, 6 Mar 2023 13:05:24 +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 4PVf2D1mSkz3Gth; Mon, 6 Mar 2023 13:05:24 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1678107924; 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=2rKbF+osZg1uuTa4WuopFCnftdGheBDuRtbaZecx48k=; b=jRAE6vyjZLVp4Tk0YCzKwR6RkSMBsWX05arByPtgJ9mkawn2/H3lLarzsDoFxR7tqS0mr4 7a/jQfLZu56o58vzVOhJHDCyy1c+EIMdSb+GgMezfeUV9KFQ1YNDEYm1Zd+n+2wqwS+tVH iTpDq4tPdKPGL88CQz7Ylm3e7hlrfjdK4/G2UQhVRotAZ0O0RsRm5GeJrJ8LowxWDfhXon ydnj2bAIdVIQQwL40W3z2jLi1xcxv7KEwUUDTIfI753rDhbfo56wd9y/tPXyKhN8AIWiHg 1WM2CoZiL26c2lP6WoJxrhkyT/jpJvFQ++Lhq7udq2EOUknX5H4zwLZVaGB6FQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1678107924; 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=2rKbF+osZg1uuTa4WuopFCnftdGheBDuRtbaZecx48k=; b=siJvNdIsmx4CACl7Qboml1eXmik7q6vvS3lLtiCdhGpGFsXLfRdG1rKNIle3dI+Fl1yjP6 rmR3Rryu7qRRKvHSOa9h7JBMIWMlQffnuffLni8ADeYWF3ImZ4TLFmOIKGYwBtbOKBALQQ E+JLS31hQWEjhkzVw6CLx9EiY9HWLXTaC28pGn8cZz0tzRb3T9GyPLOIYJCKkJTMSrC8YU f980b5ov5tYHX2sPS9HeF9TfshlNCSpU9lNk8OXIFz46lJywWt0jqcZI43drfcZJmmChyW Zs++VwzJpjj8kRBFBroWgySuNa78gmmbjhKfWsOSzWAN/nHothuQXEGnRhYoqQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1678107924; a=rsa-sha256; cv=none; b=SrZdcr43/nZy9zSA/YTYo3Zo3E8SFjw1Fs+ZqcPsk5Z+5vIz9ZCMx784e6UioT81Fh1T8E xyb7Jl4hlwCmO3w9EJ3BO8oE7O7h0/VoV85aQhOcgAEqBsg8a6L/yy2TlTLjesa18/lfL+ HzjoWc8C0AV9kXUoPCVQuCqK9DjEe4kfk3ZBkYrtlVJl6qFGVNFBULUVzvv2GtcJO+/p3r aA90ID4BA3BoL1p4V8tq5Zwz8IWdd6YEK24nAePxSjTC//RzpHLZgYQslp5Ts5oKl6Zhzl U7q7kw2bhc/Iz1ozy6cQ8VeQhpEQZTXojB4xFXjRfEHWDvDKR89pQ4wk1TzsQw== 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 4PVf2D0sj5z134x; Mon, 6 Mar 2023 13:05:24 +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 326D5Obe079341; Mon, 6 Mar 2023 13:05:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 326D5OA2079340; Mon, 6 Mar 2023 13:05:24 GMT (envelope-from git) Date: Mon, 6 Mar 2023 13:05:24 GMT Message-Id: <202303061305.326D5OA2079340@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: =?utf-8?Q?Corvin=20K=C3=B6hne?= Subject: git: 89fe7b98fe45 - main - bhyvectl: do not return garbage from send_message List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@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/main X-Git-Reftype: branch X-Git-Commit: 89fe7b98fe45cf56d60d0d4dfa1bfad3ba6908ec Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by corvink: URL: https://cgit.FreeBSD.org/src/commit/?id=89fe7b98fe45cf56d60d0d4dfa1bfad3ba6908ec commit 89fe7b98fe45cf56d60d0d4dfa1bfad3ba6908ec Author: Vitaliy Gusev AuthorDate: 2023-03-06 11:27:10 +0000 Commit: Corvin Köhne CommitDate: 2023-03-06 13:03:40 +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 --- 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: