From e37d30f334830fab4decd52ef3c17fa09b7b0d92 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Wed, 5 Jan 2022 15:09:43 +0900 Subject: [PATCH] sd-boot: select newest kernel entry matching with the default glob pattern This fixes a bug introduced by 0c674ce5f24a6e52561ec6520e43a1ca45d90f01. Fixes #22004. --- src/boot/efi/boot.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/boot/efi/boot.c b/src/boot/efi/boot.c index 2c5bd913d27..9935f2e8795 100644 --- a/src/boot/efi/boot.c +++ b/src/boot/efi/boot.c @@ -1638,9 +1638,9 @@ static INTN config_entry_find(Config *config, const CHAR16 *needle) { if (!needle) return -1; - for (UINTN i = 0; i < config->entry_count; i++) + for (INTN i = config->entry_count - 1; i >= 0; i--) if (MetaiMatch(config->entries[i]->id, (CHAR16*) needle)) - return (INTN) i; + return i; return -1; } -- 2.47.3