git: c3f41c02c9a5 - main - vmm: Simplify the VM_ALLOC_MEMSEG ioctl a bit
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 04 Nov 2025 14:36:01 UTC
The branch main has been updated by markj:
URL: https://cgit.FreeBSD.org/src/commit/?id=c3f41c02c9a5bf45504af59c351f0ae336719753
commit c3f41c02c9a5bf45504af59c351f0ae336719753
Author: Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2025-11-04 13:52:01 +0000
Commit: Mark Johnston <markj@FreeBSD.org>
CommitDate: 2025-11-04 13:52:01 +0000
vmm: Simplify the VM_ALLOC_MEMSEG ioctl a bit
We can free the mask earlier, simplifying some error paths. No
functional change intended.
Reviewed by: corvink, jhb, emaste
Sponsored by: The FreeBSD Foundation
Sponsored by: Klara, Inc.
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D53418
---
sys/dev/vmm/vmm_dev.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/sys/dev/vmm/vmm_dev.c b/sys/dev/vmm/vmm_dev.c
index ebbceb25b69e..bd20acac1d2d 100644
--- a/sys/dev/vmm/vmm_dev.c
+++ b/sys/dev/vmm/vmm_dev.c
@@ -619,20 +619,16 @@ vmmdev_ioctl(struct cdev *cdev, u_long cmd, caddr_t data, int fflag,
}
error = domainset_populate(&domain, mask, mseg->ds_policy,
mseg->ds_mask_size);
- if (error) {
- free(mask, M_VMMDEV);
+ free(mask, M_VMMDEV);
+ if (error)
break;
- }
domainset = domainset_create(&domain);
if (domainset == NULL) {
error = EINVAL;
- free(mask, M_VMMDEV);
break;
}
- free(mask, M_VMMDEV);
}
error = alloc_memseg(sc, mseg, sizeof(mseg->name), domainset);
-
break;
}
case VM_GET_MEMSEG: