Date: Mon, 1 May 2023 21:04:20 GMT From: Warner Losh <imp@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: d5babd0d2376 - main - stand/efi: Simplify code here Message-ID: <202305012104.341L4KVY051892@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202305012104.341L4KVY051892>