From nobody Wed May 29 19:41:02 2024
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 4VqKW23Np1z5L91t;
	Wed, 29 May 2024 19:41:02 +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 4VqKW22vpXz52DD;
	Wed, 29 May 2024 19:41:02 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717011662;
	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=GpHLPmbmPXQVizF+LAUMb01qCZLki+agTDgzbG9GKpU=;
	b=XOQ+l3cliPN/Bw6dop5NqfmiK61NV202rliMM6m+uAG28BpbIhFjq5Lo7N4qyk/wqjf1lD
	vsTlF9klTXcq6gdFe25G4998xy82AzZzO3tN7+BI6Pb8YoKxQm8ukMItromGlD7aicyQFm
	HBT44usMWPitBeS06Y8YsFyzEZh9cLC7wUzL3xZ9WvZ0weEg7gygfDq9CGvGwAgJRna097
	BLe52JPxbYW7eo2g23sb8CUOLk4wCKxGXMSqVzEKgzhZhqIshA5I8bTcc8y1Qpbirj3oUl
	z9MimT9+cbeSJ/dB2K60x8GgzuD0htEup/5bnEU9fHpg3Y4iA/YI55MyqC/hGw==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717011662; a=rsa-sha256; cv=none;
	b=iQfNUDxQn7G8vRnMDlR3VH4p0j/DSjosI6MQG/7zsYvElpSEbp+hdzyF+bTmjpxKN3IWdl
	UyrS3vHdqJUr74TaMzUnozq2UNILtjadlbeZRaJdu5+O8hOGtYwm69IsJFwMpX9TCsN5Tr
	BP+biOPTMgCXeAEyXSTLrJgPfCF+JnLcSmoXQFOlmBoC9UbHLbl5qMbDBT8V/GXWNiji/3
	WyVUWMcE+cj7IXY7XxeKuLy6VrLu/Wt/fssLgj1hBe6wWq2HFi0rkWw/bbbkKo1pSagbt/
	QUAAVCAynQAtVVYuMyAsaLPpHaVRYhS2pjpBkBevJ4CXDSdQf6n+JCiJmFOpjg==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717011662;
	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=GpHLPmbmPXQVizF+LAUMb01qCZLki+agTDgzbG9GKpU=;
	b=EGDTHVGxDi/qKPnDWuCpLPkJJaPzzArwtfPdOPjztiig/xSM5ZXEYOi2fliER4rLVW2UdI
	Us99xTOMWpRMLsAOmJBlxfeSBxNjEZcBXwFYDvh5obA4qCW+OT95oQee3I0IdzI5ZbS7fU
	Upv5OFc8hdgzY4R2rWwBmM3S9LTu6umep4ToSqqDNGozFZlIzGrJApls8mv7gJrI5CEMbu
	MT7uU5iphw1uXta0ktPGYrAtQfYm3+hpA09xvbJabC548Oa09j5Mg3EzcvK7G4yTu+Nk0S
	sRXjk+9SGYCvymVh2Xl/W6J4hVAPb5Cd+o0cAIaalSryseGc6VlBB/ggFmh9nw==
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 4VqKW22TW1z188m;
	Wed, 29 May 2024 19:41:02 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 44TJf2p3015096;
	Wed, 29 May 2024 19:41:02 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 44TJf2nU015093;
	Wed, 29 May 2024 19:41:02 GMT
	(envelope-from git)
Date: Wed, 29 May 2024 19:41:02 GMT
Message-Id: <202405291941.44TJf2nU015093@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
        dev-commits-src-main@FreeBSD.org
From: Warner Losh <imp@FreeBSD.org>
Subject: git: 19dbf72a2701 - main - bhyve: correctly remove a memory
  mapping
List-Id: Commit messages for all branches of the src repository <dev-commits-src-all.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all
List-Help: <mailto:dev-commits-src-all+help@freebsd.org>
List-Post: <mailto:dev-commits-src-all@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-all+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-all+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-all@freebsd.org
Sender: owner-dev-commits-src-all@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: imp
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: 19dbf72a270125621268e8b07ccc9ac99c67e7d0
Auto-Submitted: auto-generated

The branch main has been updated by imp:

URL: https://cgit.FreeBSD.org/src/commit/?id=19dbf72a270125621268e8b07ccc9ac99c67e7d0

commit 19dbf72a270125621268e8b07ccc9ac99c67e7d0
Author:     Pierre Pronchery <pierre@freebsdfoundation.org>
AuthorDate: 2024-05-29 18:00:02 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2024-05-29 19:39:29 +0000

    bhyve: correctly remove a memory mapping
    
    In a normal code path while setting up GPU passthrough, the size
    parameter to munmap() is wrong and its operation not checked for errors,
    therefore leaking resources.
    
    Reported by:    Coverity Scan
    CID:            1519830
    Sponsored by:   The FreeBSD Foundation
    
    Reviewed by: imp
    Pull Request: https://github.com/freebsd/freebsd-src/pull/1262
---
 usr.sbin/bhyve/amd64/pci_gvt-d.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/usr.sbin/bhyve/amd64/pci_gvt-d.c b/usr.sbin/bhyve/amd64/pci_gvt-d.c
index f64cc5984352..dfcd6a8f68c8 100644
--- a/usr.sbin/bhyve/amd64/pci_gvt-d.c
+++ b/usr.sbin/bhyve/amd64/pci_gvt-d.c
@@ -220,7 +220,7 @@ gvt_d_setup_opregion(struct pci_devinst *const pi)
 
 	opregion->hpa = asls;
 	opregion->len = header->size * KB;
-	munmap(header, sizeof(header));
+	munmap(header, sizeof(*header));
 
 	opregion->hva = mmap(NULL, opregion->len * KB, PROT_READ, MAP_SHARED,
 	    memfd, opregion->hpa);