From: Yu Watanabe Date: Wed, 5 Jan 2022 06:09:43 +0000 (+0900) Subject: sd-boot: select newest kernel entry matching with the default glob pattern X-Git-Tag: v251-rc1~593 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e37d30f334830fab4decd52ef3c17fa09b7b0d92;p=thirdparty%2Fsystemd.git sd-boot: select newest kernel entry matching with the default glob pattern This fixes a bug introduced by 0c674ce5f24a6e52561ec6520e43a1ca45d90f01. Fixes #22004. --- 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; }