git: 41cf74fe8ce5 - main - loader - guard against empty rootdev
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 20 May 2025 16:12:20 UTC
The branch main has been updated by sjg: URL: https://cgit.FreeBSD.org/src/commit/?id=41cf74fe8ce5c6f8f10aa074e9405043a242a2b1 commit 41cf74fe8ce5c6f8f10aa074e9405043a242a2b1 Author: Simon J. Gerraty <sjg@FreeBSD.org> AuthorDate: 2025-05-20 16:10:50 +0000 Commit: Simon J. Gerraty <sjg@FreeBSD.org> CommitDate: 2025-05-20 16:10:50 +0000 loader - guard against empty rootdev At least one instance of u-boot pretending to be EFI is passing empty rootdev to loader which does not end well. A simple precaution is harmless. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D50334 --- stand/common/metadata.c | 2 +- stand/efi/loader/main.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/stand/common/metadata.c b/stand/common/metadata.c index 22df6f175791..715354aedd04 100644 --- a/stand/common/metadata.c +++ b/stand/common/metadata.c @@ -111,7 +111,7 @@ md_load_dual(char *args, vm_offset_t *modulep, vm_offset_t *dtb, int kern64) * tested/set by MI code before launching the kernel. */ rootdevname = getenv("rootdev"); - if (rootdevname == NULL) + if (rootdevname == NULL || *rootdevname == '\0') rootdevname = getenv("currdev"); /* Try reading the /etc/fstab file to select the root device */ getrootmount(rootdevname); diff --git a/stand/efi/loader/main.c b/stand/efi/loader/main.c index 2384fd08b964..c9a842afb06d 100644 --- a/stand/efi/loader/main.c +++ b/stand/efi/loader/main.c @@ -513,7 +513,7 @@ find_currdev(bool do_bootmgr, bool is_last, * it's wrong. */ rootdev = getenv("rootdev"); - if (rootdev != NULL) { + if (rootdev != NULL && *rootdev != '\0') { printf(" Setting currdev to configured rootdev %s\n", rootdev); set_currdev(rootdev);