From: Jan Janssen Date: Mon, 20 Jun 2022 11:43:47 +0000 (+0200) Subject: boot: Constify PE sections type X-Git-Tag: v252-rc1~712^2~2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=6028dd6d8e54529235cf8c38ee8071a6f0c9d12b;p=thirdparty%2Fsystemd.git boot: Constify PE sections type --- diff --git a/src/boot/efi/boot.c b/src/boot/efi/boot.c index 09ad15a0ab5..fc027938604 100644 --- a/src/boot/efi/boot.c +++ b/src/boot/efi/boot.c @@ -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; diff --git a/src/boot/efi/pe.c b/src/boot/efi/pe.c index 4af6f7cfd52..b0a231bc088 100644 --- a/src/boot/efi/pe.c +++ b/src/boot/efi/pe.c @@ -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; diff --git a/src/boot/efi/pe.h b/src/boot/efi/pe.h index 3aad22e165e..ea4801ced59 100644 --- a/src/boot/efi/pe.h +++ b/src/boot/efi/pe.h @@ -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); diff --git a/src/boot/efi/stub.c b/src/boot/efi/stub.c index 9af3193d490..f348b4dc510 100644 --- a/src/boot/efi/stub.c +++ b/src/boot/efi/stub.c @@ -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;