summaryrefslogtreecommitdiffstats
path: root/drivers/acpi/nfit/core.c
diff options
context:
space:
mode:
authorKees Cook <kees@outflux.net>2023-04-05 15:50:18 +0200
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2023-04-06 20:29:11 +0200
commit74522fea27f8a0695f529089130da64ac98f1761 (patch)
treebfab89b09bfbc9ab1b85aaa00ede8c97652a2d3c /drivers/acpi/nfit/core.c
parent48ff467c338b184bc309ea2e0d2a9524f569d245 (diff)
downloadlinux-stable-74522fea27f8a0695f529089130da64ac98f1761.tar.gz
linux-stable-74522fea27f8a0695f529089130da64ac98f1761.tar.bz2
linux-stable-74522fea27f8a0695f529089130da64ac98f1761.zip
ACPICA: actbl2: Replace 1-element arrays with flexible arrays
ACPICA commit 44f1af0664599e87bebc3a1260692baa27b2f264 Similar to "Replace one-element array with flexible-array", replace the 1-element array with a proper flexible array member as defined by C99. This allows the code to operate without tripping compile-time and run- time bounds checkers (e.g. via __builtin_object_size(), -fsanitize=bounds, and/or -fstrict-flex-arrays=3). The sizeof() uses with struct acpi_nfit_flush_address and struct acpi_nfit_smbios have been adjusted to drop the open-coded subtraction of the trailing single element. The result is no binary differences in .text nor .data sections. Link: https://github.com/acpica/acpica/commit/44f1af06 Signed-off-by: Bob Moore <robert.moore@intel.com> Co-developed-by: Dan Williams <dan.j.williams@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/acpi/nfit/core.c')
-rw-r--r--drivers/acpi/nfit/core.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/acpi/nfit/core.c b/drivers/acpi/nfit/core.c
index 4e48d6db05eb..85d9d67e38a4 100644
--- a/drivers/acpi/nfit/core.c
+++ b/drivers/acpi/nfit/core.c
@@ -894,7 +894,7 @@ static size_t sizeof_flush(struct acpi_nfit_flush_address *flush)
{
if (flush->header.length < sizeof(*flush))
return 0;
- return sizeof(*flush) + sizeof(u64) * (flush->hint_count - 1);
+ return struct_size(flush, hint_address, flush->hint_count);
}
static bool add_flush(struct acpi_nfit_desc *acpi_desc,
@@ -3477,7 +3477,7 @@ static __init int nfit_init(void)
BUILD_BUG_ON(sizeof(struct acpi_nfit_system_address) != 64);
BUILD_BUG_ON(sizeof(struct acpi_nfit_memory_map) != 48);
BUILD_BUG_ON(sizeof(struct acpi_nfit_interleave) != 20);
- BUILD_BUG_ON(sizeof(struct acpi_nfit_smbios) != 9);
+ BUILD_BUG_ON(sizeof(struct acpi_nfit_smbios) != 8);
BUILD_BUG_ON(sizeof(struct acpi_nfit_control_region) != 80);
BUILD_BUG_ON(sizeof(struct acpi_nfit_data_region) != 40);
BUILD_BUG_ON(sizeof(struct acpi_nfit_capabilities) != 16);