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
This commit is contained in:
Simon J. Gerraty
2025-05-20 09:10:50 -07:00
parent 0693c3f7cb
commit 41cf74fe8c
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -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);
+1 -1
View File
@@ -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);