]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
boot: Use void for base pointer
authorJan Janssen <medhefgo@web.de>
Mon, 20 Jun 2022 11:10:41 +0000 (13:10 +0200)
committerJan Janssen <medhefgo@web.de>
Thu, 7 Jul 2022 08:08:18 +0000 (10:08 +0200)
src/boot/efi/pe.c
src/boot/efi/pe.h

index 4a06268a429ef8e85be440c664656c2ffeb7429d..4af6f7cfd524337be727bc909f54661c5732d9cf 100644 (file)
@@ -247,11 +247,7 @@ EFI_STATUS pe_alignment_info(
         return EFI_SUCCESS;
 }
 
-EFI_STATUS pe_memory_locate_sections(
-                const char *base,
-                const char **sections,
-                UINTN *addrs,
-                UINTN *sizes) {
+EFI_STATUS pe_memory_locate_sections(const void *base, const char **sections, UINTN *addrs, UINTN *sizes) {
         const struct DosFileHeader *dos;
         const struct PeFileHeader *pe;
         UINTN offset;
@@ -261,17 +257,21 @@ EFI_STATUS pe_memory_locate_sections(
         assert(addrs);
         assert(sizes);
 
-        dos = (const struct DosFileHeader*)base;
+        dos = (const struct DosFileHeader *) base;
         if (!verify_dos(dos))
                 return EFI_LOAD_ERROR;
 
-        pe = (const struct PeFileHeader*)&base[dos->ExeHeader];
+        pe = (const struct PeFileHeader *) ((uint8_t *) base + dos->ExeHeader);
         if (!verify_pe(pe, /* allow_compatibility= */ false))
                 return EFI_LOAD_ERROR;
 
         offset = section_table_offset(dos, pe);
-        locate_sections((struct PeSectionHeader*)&base[offset], pe->FileHeader.NumberOfSections,
-                        sections, addrs, NULL, sizes);
+        locate_sections((struct PeSectionHeader *) ((uint8_t *) base + offset),
+                        pe->FileHeader.NumberOfSections,
+                        sections,
+                        addrs,
+                        NULL,
+                        sizes);
 
         return EFI_SUCCESS;
 }
index 1a7ba51fe5fc4b1502d8b70f7c710d1890cf62e7..3aad22e165e0983e11b8e1a462e4b1c767f01001 100644 (file)
@@ -5,7 +5,7 @@
 #include <uchar.h>
 
 EFI_STATUS pe_memory_locate_sections(
-                const char *base,
+                const void *base,
                 const char **sections,
                 UINTN *addrs,
                 UINTN *sizes);