]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
boot: Constify PE sections type
authorJan Janssen <medhefgo@web.de>
Mon, 20 Jun 2022 11:43:47 +0000 (13:43 +0200)
committerJan Janssen <medhefgo@web.de>
Thu, 7 Jul 2022 08:08:51 +0000 (10:08 +0200)
src/boot/efi/boot.c
src/boot/efi/pe.c
src/boot/efi/pe.h
src/boot/efi/stub.c

index 09ad15a0ab503676ea62a54d0586850c28ffc997..fc027938604bcccaa32958006794da3d833e5432 100644 (file)
@@ -1806,7 +1806,7 @@ static void config_title_generate(Config *config) {
 
 static bool is_sd_boot(EFI_FILE *root_dir, const char16_t *loader_path) {
         EFI_STATUS err;
-        const char *sections[] = {
+        static const char * const sections[] = {
                 ".sdmagic",
                 NULL
         };
@@ -2082,7 +2082,7 @@ static void config_entry_add_unified(
                         continue;
 
                 /* look for .osrel and .cmdline sections in the .efi binary */
-                err = pe_file_locate_sections(linux_dir, f->FileName, (const char **) sections, offs, szs);
+                err = pe_file_locate_sections(linux_dir, f->FileName, sections, offs, szs);
                 if (err != EFI_SUCCESS || szs[SECTION_OSREL] == 0)
                         continue;
 
index 4af6f7cfd524337be727bc909f54661c5732d9cf..b0a231bc0888b4506987f155e0d4aec55b0c4dea 100644 (file)
@@ -141,7 +141,7 @@ static inline UINTN section_table_offset(const struct DosFileHeader *dos, const
 static void locate_sections(
                 const struct PeSectionHeader section_table[],
                 UINTN n_table,
-                const char **sections,
+                const char * const sections[],
                 UINTN *addrs,
                 UINTN *offsets,
                 UINTN *sizes) {
@@ -247,7 +247,7 @@ EFI_STATUS pe_alignment_info(
         return EFI_SUCCESS;
 }
 
-EFI_STATUS pe_memory_locate_sections(const void *base, const char **sections, UINTN *addrs, UINTN *sizes) {
+EFI_STATUS pe_memory_locate_sections(const void *base, const char * const sections[], UINTN *addrs, UINTN *sizes) {
         const struct DosFileHeader *dos;
         const struct PeFileHeader *pe;
         UINTN offset;
@@ -279,7 +279,7 @@ EFI_STATUS pe_memory_locate_sections(const void *base, const char **sections, UI
 EFI_STATUS pe_file_locate_sections(
                 EFI_FILE *dir,
                 const char16_t *path,
-                const char **sections,
+                const char * const sections[],
                 UINTN *offsets,
                 UINTN *sizes) {
         _cleanup_freepool_ struct PeSectionHeader *section_table = NULL;
index 3aad22e165e0983e11b8e1a462e4b1c767f01001..ea4801ced5963c65035403de2becfb53d48426a1 100644 (file)
@@ -6,14 +6,14 @@
 
 EFI_STATUS pe_memory_locate_sections(
                 const void *base,
-                const char **sections,
+                const char * const sections[],
                 UINTN *addrs,
                 UINTN *sizes);
 
 EFI_STATUS pe_file_locate_sections(
                 EFI_FILE *dir,
                 const char16_t *path,
-                const char **sections,
+                const char * const sections[],
                 UINTN *offsets,
                 UINTN *sizes);
 
index 9af3193d490e5ee6bdda76682165b751b137c4cd..f348b4dc510c80f57f6badf9e39110c3cd89813f 100644 (file)
@@ -195,7 +195,7 @@ EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *sys_table) {
         if (err != EFI_SUCCESS)
                 return log_error_status_stall(err, L"Error getting a LoadedImageProtocol handle: %r", err);
 
-        err = pe_memory_locate_sections(loaded_image->ImageBase, (const char **) sections, addrs, szs);
+        err = pe_memory_locate_sections(loaded_image->ImageBase, sections, addrs, szs);
         if (err != EFI_SUCCESS || szs[SECTION_LINUX] == 0) {
                 if (err == EFI_SUCCESS)
                         err = EFI_NOT_FOUND;