]> www.infradead.org Git - users/willy/pagecache.git/commitdiff
ACPI: PRM: Clean up guid type in struct prm_handler_info
authorDan Carpenter <dan.carpenter@linaro.org>
Thu, 24 Oct 2024 08:07:15 +0000 (11:07 +0300)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Thu, 24 Oct 2024 15:31:41 +0000 (17:31 +0200)
Clang 19 prints a warning when we pass &th->guid to efi_pa_va_lookup():

drivers/acpi/prmt.c:156:29: error: passing 1-byte aligned argument to
4-byte aligned parameter 1 of 'efi_pa_va_lookup' may result in an
unaligned pointer access [-Werror,-Walign-mismatch]
  156 |                         (void *)efi_pa_va_lookup(&th->guid, handler_info->handler_address);
      |                                                  ^

The problem is that efi_pa_va_lookup() takes a efi_guid_t and &th->guid
is a regular guid_t.  The difference between the two types is the
alignment.  efi_guid_t is a typedef.

typedef guid_t efi_guid_t __aligned(__alignof__(u32));

It's possible that this a bug in Clang 19.  Even though the alignment of
&th->guid is not explicitly specified, it will still end up being aligned
at 4 or 8 bytes.

Anyway, as Ard points out, it's cleaner to change guid to efi_guid_t type
and that also makes the warning go away.

Fixes: 088984c8d54c ("ACPI: PRM: Find EFI_MEMORY_RUNTIME block for PRM handler and context")
Reported-by: Linux Kernel Functional Testing <lkft@linaro.org>
Suggested-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Tested-by: Paul E. McKenney <paulmck@kernel.org>
Acked-by: Ard Biesheuvel <ardb@kernel.org>
Link: https://patch.msgid.link/3777d71b-9e19-45f4-be4e-17bf4fa7a834@stanley.mountain
[ rjw: Subject edit ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/acpi/prmt.c

index d59307a76ca31e809428715e581863a54b0cafc4..747f83f7114d295a22079e5d3b167b4af94442b5 100644 (file)
@@ -52,7 +52,7 @@ struct prm_context_buffer {
 static LIST_HEAD(prm_module_list);
 
 struct prm_handler_info {
-       guid_t guid;
+       efi_guid_t guid;
        efi_status_t (__efiapi *handler_addr)(u64, void *);
        u64 static_data_buffer_addr;
        u64 acpi_param_buffer_addr;