mirror of
https://github.com/freebsd/freebsd-src
synced 2024-10-15 21:05:08 +00:00
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
This commit is contained in:
parent
f13275cf03
commit
19dbf72a27
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue