[PATCH] uefi: uefidump: fix the boot load option Boot#### larger than Boot1000 doesn't be parsered (LP:#1225850)

Ivan Hu ivan.hu at canonical.com
Mon Sep 16 06:47:15 UTC 2013


Some firmware/BIOS create the Boot path not in order, some of Boot load options
are created larger than "Boot1000", such as Boot1001, Boot2001 etc. The uefidump
checks the boot path with the "Boot0" causes these Boot load options cannot be
parsered.

Signed-off-by: Ivan Hu <ivan.hu at canonical.com>
---
 src/uefi/uefidump/uefidump.c |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/uefi/uefidump/uefidump.c b/src/uefi/uefidump/uefidump.c
index c072847..e4b6546 100644
--- a/src/uefi/uefidump/uefidump.c
+++ b/src/uefi/uefidump/uefidump.c
@@ -18,6 +18,7 @@
  */
 #include <stddef.h>
 #include <inttypes.h>
+#include <ctype.h>
 
 #include "fwts.h"
 #include "fwts_uefi.h"
@@ -747,7 +748,6 @@ static uefidump_info uefidump_info_table[] = {
 	{ "LangCodes",		uefidump_info_langcodes },
 	{ "Lang",		uefidump_info_lang },
 	{ "Timeout",		uefidump_info_timeout },
-	{ "Boot0",		uefidump_info_bootdev },
 	{ "dump-type0-",	uefidump_info_dump_type0 },
 	{ "SecureBoot",		uefidump_info_secure_boot },
 	{ "SetupMode",		uefidump_info_setup_mode },
@@ -781,6 +781,14 @@ static void uefidump_var(fwts_framework *fw, fwts_uefi_var *var)
 		}
 	}
 
+	/* Check the boot load option Boot####. #### is a printed hex value */
+	if ((strlen(varname) == 8) && (strncmp(varname, "Boot", 4) == 0)
+			&& isxdigit(varname[4]) && isxdigit(varname[5])
+			&& isxdigit(varname[6]) && isxdigit(varname[7])) {
+		uefidump_info_bootdev(fw, var);
+		return;
+	}
+
 	/* otherwise just do a plain old hex dump */
 	uefidump_var_hexdump(fw, var);
 }
-- 
1.7.9.5




More information about the fwts-devel mailing list