]> git.baikalelectronics.ru Git - uboot.git/commitdiff
efi_loader: adjust sorting of capsules
authorHeinrich Schuchardt <heinrich.schuchardt@canonical.com>
Thu, 29 Dec 2022 13:44:05 +0000 (14:44 +0100)
committerHeinrich Schuchardt <heinrich.schuchardt@canonical.com>
Wed, 4 Jan 2023 12:17:42 +0000 (13:17 +0100)
Up to now we only compared the first letter of the capsule name to sort
them alphabetically. Properly sort by the Unicode alphabet.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
lib/efi_loader/efi_capsule.c

index 1163a2ee30163e2464c7289dedbf8e93274db532..0997cd248fe353e46354bff70adb062f2a7ab098 100644 (file)
@@ -1108,10 +1108,13 @@ static efi_status_t efi_capsule_scan_dir(u16 ***files, unsigned int *num)
        /* ignore an error */
        EFI_CALL((*dirh->close)(dirh));
 
-       /* in ascii order */
-       /* FIXME: u16 version of strcasecmp */
+       /*
+        * Capsule files are applied in case insensitive alphabetic order
+        *
+        * TODO: special handling of rightmost period
+        */
        qsort(tmp_files, count, sizeof(*tmp_files),
-             (int (*)(const void *, const void *))strcasecmp);
+             (int (*)(const void *, const void *))u16_strcasecmp);
        *files = tmp_files;
        *num = count;
        ret = EFI_SUCCESS;