aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKees Cook <keescook@chromium.org>2017-06-26 18:53:07 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2017-06-27 16:27:24 -0400
commit3d867f6c5fd6535cdeceef3170e5e84e5dd80fc1 (patch)
tree4374a9f054e2c1a5580f8c7a5034b9421598cdcd
parenta976c2951d8f376112361830aa7762beff83a205 (diff)
ACPICA: Use designated initializers
The struct layout randomization plugin detects and randomizes any structs that contain only function pointers. Once layout is randomized, all initialization must be designated or the compiler will misalign the assignments. This switches all the ACPICA function pointer struct to use designated initializers, using the proposed upstream ACPICA macro: https://github.com/acpica/acpica/pull/248/ Signed-off-by: Kees Cook <keescook@chromium.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r--drivers/acpi/acpica/hwxfsleep.c14
-rw-r--r--include/acpi/platform/acenv.h4
-rw-r--r--include/acpi/platform/aclinux.h2
3 files changed, 15 insertions, 5 deletions
diff --git a/drivers/acpi/acpica/hwxfsleep.c b/drivers/acpi/acpica/hwxfsleep.c
index 5733b1167e46..7ef13934968f 100644
--- a/drivers/acpi/acpica/hwxfsleep.c
+++ b/drivers/acpi/acpica/hwxfsleep.c
@@ -70,11 +70,15 @@ static acpi_status acpi_hw_sleep_dispatch(u8 sleep_state, u32 function_id);
70/* Legacy functions are optional, based upon ACPI_REDUCED_HARDWARE */ 70/* Legacy functions are optional, based upon ACPI_REDUCED_HARDWARE */
71 71
72static struct acpi_sleep_functions acpi_sleep_dispatch[] = { 72static struct acpi_sleep_functions acpi_sleep_dispatch[] = {
73 {ACPI_HW_OPTIONAL_FUNCTION(acpi_hw_legacy_sleep), 73 {ACPI_STRUCT_INIT(legacy_function,
74 acpi_hw_extended_sleep}, 74 ACPI_HW_OPTIONAL_FUNCTION(acpi_hw_legacy_sleep)),
75 {ACPI_HW_OPTIONAL_FUNCTION(acpi_hw_legacy_wake_prep), 75 ACPI_STRUCT_INIT(extended_function, acpi_hw_extended_sleep) },
76 acpi_hw_extended_wake_prep}, 76 {ACPI_STRUCT_INIT(legacy_function,
77 {ACPI_HW_OPTIONAL_FUNCTION(acpi_hw_legacy_wake), acpi_hw_extended_wake} 77 ACPI_HW_OPTIONAL_FUNCTION(acpi_hw_legacy_wake_prep)),
78 ACPI_STRUCT_INIT(extended_function, acpi_hw_extended_wake_prep) },
79 {ACPI_STRUCT_INIT(legacy_function,
80 ACPI_HW_OPTIONAL_FUNCTION(acpi_hw_legacy_wake)),
81 ACPI_STRUCT_INIT(extended_function, acpi_hw_extended_wake) }
78}; 82};
79 83
80/* 84/*
diff --git a/include/acpi/platform/acenv.h b/include/acpi/platform/acenv.h
index 09994b063243..912563c66948 100644
--- a/include/acpi/platform/acenv.h
+++ b/include/acpi/platform/acenv.h
@@ -382,4 +382,8 @@
382#define ACPI_INIT_FUNCTION 382#define ACPI_INIT_FUNCTION
383#endif 383#endif
384 384
385#ifndef ACPI_STRUCT_INIT
386#define ACPI_STRUCT_INIT(field, value) value
387#endif
388
385#endif /* __ACENV_H__ */ 389#endif /* __ACENV_H__ */
diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h
index a39e3f67616f..047f13865608 100644
--- a/include/acpi/platform/aclinux.h
+++ b/include/acpi/platform/aclinux.h
@@ -178,6 +178,8 @@
178#define ACPI_MSG_BIOS_ERROR KERN_ERR "ACPI BIOS Error (bug): " 178#define ACPI_MSG_BIOS_ERROR KERN_ERR "ACPI BIOS Error (bug): "
179#define ACPI_MSG_BIOS_WARNING KERN_WARNING "ACPI BIOS Warning (bug): " 179#define ACPI_MSG_BIOS_WARNING KERN_WARNING "ACPI BIOS Warning (bug): "
180 180
181#define ACPI_STRUCT_INIT(field, value) .field = value
182
181#else /* !__KERNEL__ */ 183#else /* !__KERNEL__ */
182 184
183#define ACPI_USE_STANDARD_HEADERS 185#define ACPI_USE_STANDARD_HEADERS