git: d5babd0d2376 - main - stand/efi: Simplify code here
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 01 May 2023 21:04:20 UTC
The branch main has been updated by imp:
URL: https://cgit.FreeBSD.org/src/commit/?id=d5babd0d23769d365a83bebc0a5cd8cbfb55564d
commit d5babd0d23769d365a83bebc0a5cd8cbfb55564d
Author: Warner Losh <imp@FreeBSD.org>
AuthorDate: 2023-05-01 15:28:25 +0000
Commit: Warner Losh <imp@FreeBSD.org>
CommitDate: 2023-05-01 21:02:53 +0000
stand/efi: Simplify code here
We have plenty of stack in the EFI case, so use it instead of the
complicated malloc / free dance.
Sponsored by: Netflix
Reviewed by: tsoome, kevans
Differential Revision: https://reviews.freebsd.org/D39415
---
stand/efi/loader/main.c | 19 ++++++++-----------
1 file changed, 8 insertions(+), 11 deletions(-)
diff --git a/stand/efi/loader/main.c b/stand/efi/loader/main.c
index 9ff5f1dd7674..e5f9b40ae55f 100644
--- a/stand/efi/loader/main.c
+++ b/stand/efi/loader/main.c
@@ -252,7 +252,6 @@ probe_zfs_currdev(uint64_t guid)
{
char *devname;
struct zfs_devdesc currdev;
- char *buf = NULL;
bool bootable;
currdev.dd.d_dev = &zfs_dev;
@@ -265,18 +264,16 @@ probe_zfs_currdev(uint64_t guid)
bootable = sanity_check_currdev();
if (bootable) {
- buf = malloc(VDEV_PAD_SIZE);
- if (buf != NULL) {
- if (zfs_get_bootonce(&currdev, OS_BOOTONCE, buf,
- VDEV_PAD_SIZE) == 0) {
- printf("zfs bootonce: %s\n", buf);
- set_currdev(buf);
- setenv("zfs-bootonce", buf, 1);
- }
- free(buf);
- (void) zfs_attach_nvstore(&currdev);
+ char buf[VDEV_PAD_SIZE];
+
+ if (zfs_get_bootonce(&currdev, OS_BOOTONCE, buf, sizeof(buf)) == 0) {
+ printf("zfs bootonce: %s\n", buf);
+ set_currdev(buf);
+ setenv("zfs-bootonce", buf, 1);
}
+ (void)zfs_attach_nvstore(&currdev);
}
+
return (bootable);
}
#endif