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
This commit is contained in:
Warner Losh 2023-05-01 09:28:25 -06:00
parent 5ce98ee5f4
commit d5babd0d23

View file

@ -252,7 +252,6 @@ probe_zfs_currdev(uint64_t guid)
{ {
char *devname; char *devname;
struct zfs_devdesc currdev; struct zfs_devdesc currdev;
char *buf = NULL;
bool bootable; bool bootable;
currdev.dd.d_dev = &zfs_dev; currdev.dd.d_dev = &zfs_dev;
@ -265,18 +264,16 @@ probe_zfs_currdev(uint64_t guid)
bootable = sanity_check_currdev(); bootable = sanity_check_currdev();
if (bootable) { if (bootable) {
buf = malloc(VDEV_PAD_SIZE); char buf[VDEV_PAD_SIZE];
if (buf != NULL) {
if (zfs_get_bootonce(&currdev, OS_BOOTONCE, buf, if (zfs_get_bootonce(&currdev, OS_BOOTONCE, buf, sizeof(buf)) == 0) {
VDEV_PAD_SIZE) == 0) {
printf("zfs bootonce: %s\n", buf); printf("zfs bootonce: %s\n", buf);
set_currdev(buf); set_currdev(buf);
setenv("zfs-bootonce", buf, 1); setenv("zfs-bootonce", buf, 1);
} }
free(buf); (void)zfs_attach_nvstore(&currdev);
(void) zfs_attach_nvstore(&currdev);
}
} }
return (bootable); return (bootable);
} }
#endif #endif