Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 16 Mar 2018 18:12:50 +0000 (UTC)
From:      Warner Losh <imp@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r331067 - head/stand/efi/boot1
Message-ID:  <201803161812.w2GICoYV057285@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: imp
Date: Fri Mar 16 18:12:50 2018
New Revision: 331067
URL: https://svnweb.freebsd.org/changeset/base/331067

Log:
  Only print boot order / boot current if we can get the variables from
  the loader. Some UEFI implementations don't return all of them.
  
  Sponsored by: Netflix

Modified:
  head/stand/efi/boot1/boot1.c

Modified: head/stand/efi/boot1/boot1.c
==============================================================================
--- head/stand/efi/boot1/boot1.c	Fri Mar 16 18:04:13 2018	(r331066)
+++ head/stand/efi/boot1/boot1.c	Fri Mar 16 18:12:50 2018	(r331067)
@@ -467,16 +467,18 @@ efi_main(EFI_HANDLE Ximage, EFI_SYSTEM_TABLE *Xsystab)
 
 	boot_current = 0;
 	sz = sizeof(boot_current);
-	efi_global_getenv("BootCurrent", &boot_current, &sz);
-	printf("   BootCurrent: %04x\n", boot_current);
+	if (efi_global_getenv("BootCurrent", &boot_current, &sz) == EFI_SUCCESS) {
+		printf("   BootCurrent: %04x\n", boot_current);
 
-	sz = sizeof(boot_order);
-	efi_global_getenv("BootOrder", &boot_order, &sz);
-	printf("   BootOrder:");
-	for (i = 0; i < sz / sizeof(boot_order[0]); i++)
-		printf(" %04x%s", boot_order[i],
-		    boot_order[i] == boot_current ? "[*]" : "");
-	printf("\n");
+		sz = sizeof(boot_order);
+		if (efi_global_getenv("BootOrder", &boot_order, &sz) == EFI_SUCCESS) {
+			printf("   BootOrder:");
+			for (i = 0; i < sz / sizeof(boot_order[0]); i++)
+				printf(" %04x%s", boot_order[i],
+				    boot_order[i] == boot_current ? "[*]" : "");
+			printf("\n");
+		}
+	}
 
 #ifdef TEST_FAILURE
 	/*



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201803161812.w2GICoYV057285>