This is apparently very hard.  Caught this on arm64 where
efi_device_path_depth() returned 0, which resulted in always selecting
the first device.  Clearly if the first path component (i = 0) matches
the desired type, we should return 1, not 0.  Here is the amd64
version of the diff which is easier to test for people.

ok?


Index: arch/amd64/stand/efiboot/conf.c
===================================================================
RCS file: /cvs/src/sys/arch/amd64/stand/efiboot/conf.c,v
retrieving revision 1.8
diff -u -p -r1.8 conf.c
--- arch/amd64/stand/efiboot/conf.c     1 Jun 2017 11:32:15 -0000       1.8
+++ arch/amd64/stand/efiboot/conf.c     29 Jul 2017 12:54:10 -0000
@@ -38,7 +38,7 @@
 #include "efiboot.h"
 #include "efidev.h"
 
-const char version[] = "3.33";
+const char version[] = "3.34";
 
 #ifdef EFI_DEBUG
 int    debug = 0;
Index: arch/amd64/stand/efiboot/efiboot.c
===================================================================
RCS file: /cvs/src/sys/arch/amd64/stand/efiboot/efiboot.c,v
retrieving revision 1.20
diff -u -p -r1.20 efiboot.c
--- arch/amd64/stand/efiboot/efiboot.c  1 Jun 2017 11:32:15 -0000       1.20
+++ arch/amd64/stand/efiboot/efiboot.c  29 Jul 2017 12:54:10 -0000
@@ -222,7 +222,7 @@ efi_device_path_depth(EFI_DEVICE_PATH *d
 
        for (i = 0; !IsDevicePathEnd(dp); dp = NextDevicePathNode(dp), i++) {
                if (DevicePathType(dp) == dptype)
-                       return (i);
+                       return (i + 1);
        }
 
        return (-1);

Reply via email to