From: Jan Kiszka <[email protected]> We can do better, also by introducing a type for the probe function. No functional change intended.
Signed-off-by: Jan Kiszka <[email protected]> --- .github/workflows/main.yaml | 2 -- main.c | 6 ++++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 62065d7..2bdcb8c 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -134,8 +134,6 @@ jobs: # Some functions are used by linker wrapping suppress+=" --suppress=unusedFunction:tools/tests/test_probe_config_file.c" suppress+=" --suppress=unusedFunction:tools/tests/test_ebgenv_api.c" - # EFI uses void* as ImageBase needed for further calculations - suppress+=" --suppress=arithOperationsOnVoidPointer:main.c" # False positive on init_array iteration suppress+=" --suppress=comparePointers:main.c" # False positive on constructors, first hit diff --git a/main.c b/main.c index 826a16b..ccf77b4 100644 --- a/main.c +++ b/main.c @@ -30,6 +30,8 @@ extern CHAR16 *boot_medium_path; #define PCI_GET_VENDOR_ID(id) (UINT16)(id) #define PCI_GET_PRODUCT_ID(id) (UINT16)((id) >> 16) +typedef EFI_STATUS (*WATCHDOG_PROBE)(EFI_PCI_IO *, UINT16, UINT16, UINTN); + static EFI_STATUS probe_watchdogs(EFI_LOADED_IMAGE *loaded_image, UINTN timeout) { if (init_array_end - init_array_start == 0) { @@ -81,10 +83,10 @@ static EFI_STATUS probe_watchdogs(EFI_LOADED_IMAGE *loaded_image, UINTN timeout) continue; } - EFI_STATUS (*probe)(EFI_PCI_IO *, UINT16, UINT16, UINTN); for (const unsigned long *entry = init_array_start; entry < init_array_end; entry++) { - probe = loaded_image->ImageBase + *entry; + WATCHDOG_PROBE probe = (WATCHDOG_PROBE) + (UINT8 * ) loaded_image->ImageBase + *entry; if ((status = probe(pci_io, PCI_GET_VENDOR_ID(value), PCI_GET_PRODUCT_ID(value), timeout)) == EFI_SUCCESS) { -- 2.34.1 -- You received this message because you are subscribed to the Google Groups "EFI Boot Guard" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/efibootguard-dev/950fbd5f-3909-cb3d-dfdc-57de8400a1f3%40siemens.com.
