public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v1 1/4] x86: acpi: Annotate struct acpi_table_header with __packed
Date: Thu, 29 Aug 2019 17:04:18 +0300	[thread overview]
Message-ID: <20190829140421.2830-1-andriy.shevchenko@linux.intel.com> (raw)

GCC starts complaining about possible pointer misalignment of pointers to the
unpacked (alignment=4) structures in the packed (alignment=1) ones:

  CC      arch/x86/cpu/tangier/acpi.o
arch/x86/cpu/tangier/acpi.c: In function ‘acpi_create_fadt’:
arch/x86/cpu/tangier/acpi.c:22:37: warning: taking address of packed member of ‘struct acpi_fadt’ may result in an unaligned pointer value [-Waddress-of-packed-member]
  22 |  struct acpi_table_header *header = &(fadt->header);

  CC      arch/x86/lib/acpi_table.o
arch/x86/lib/acpi_table.c: In function ‘acpi_create_spcr’:
arch/x86/lib/acpi_table.c:366:37: warning: taking address of packed member of ‘struct acpi_spcr’ may result in an unaligned pointer value [-Waddress-of-packed-member]
  366 |  struct acpi_table_header *header = &(spcr->header);

Fix the potential issues by annotating embedded structures with __packed even
though they are packed naturally.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 arch/x86/include/asm/acpi_table.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/include/asm/acpi_table.h b/arch/x86/include/asm/acpi_table.h
index 02aea127c1..7588913f93 100644
--- a/arch/x86/include/asm/acpi_table.h
+++ b/arch/x86/include/asm/acpi_table.h
@@ -34,7 +34,7 @@ struct acpi_rsdp {
 };
 
 /* Generic ACPI header, provided by (almost) all tables */
-struct acpi_table_header {
+struct __packed acpi_table_header {
 	char signature[4];	/* ACPI signature (4 ASCII characters) */
 	u32 length;		/* Table length in bytes (incl. header) */
 	u8 revision;		/* Table version (not ACPI version!) */
-- 
2.23.0.rc1

             reply	other threads:[~2019-08-29 14:04 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-29 14:04 Andy Shevchenko [this message]
2019-08-29 14:04 ` [U-Boot] [PATCH v1 2/4] x86: tangier: Reserve PCI ECAM in motherboard resources Andy Shevchenko
2019-09-10  8:14   ` Bin Meng
2019-09-10  8:21     ` Bin Meng
2019-08-29 14:04 ` [U-Boot] [PATCH v1 3/4] x86: tangier: Fix off-by-one error when preparing CSRT Andy Shevchenko
2019-09-10  8:14   ` Bin Meng
2019-09-10  8:21     ` Bin Meng
2019-08-29 14:04 ` [U-Boot] [PATCH v1 4/4] x86: tangier: Use spaces over TABs in ASL code Andy Shevchenko
2019-09-10  8:14   ` Bin Meng
2019-09-10  8:21     ` Bin Meng
2019-08-29 14:13 ` [U-Boot] [PATCH v1 1/4] x86: acpi: Annotate struct acpi_table_header with __packed Bin Meng
2019-08-29 14:28   ` Andy Shevchenko
2019-09-10  8:14     ` Bin Meng
2019-09-10  8:20       ` Bin Meng

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190829140421.2830-1-andriy.shevchenko@linux.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox