mirror of
https://github.com/hardkernel/linux.git
synced 2026-03-25 03:50:24 +09:00
ANDROID: fips140: remove unnecessary no_sanitize(cfi)
gcc segfaults when compiling fips140-module.c because it doesn't like
__attribute__((__no_sanitize__("cfi"))) on fips140_init(). This
attribute is needed for clang. However this attribute is already
included in __init when the compiler is clang. Therefore, remove this
redundant attribute. (Later kernel branches have also switched to kcfi,
which doesn't need to be disabled here anyway.)
For futureproofing also use initcall_t from <linux/init.h>.
Bug: 349612732
Change-Id: Ic5cfaef177b58abf21f1737579d75b4df4d0d09c
Signed-off-by: Eric Biggers <ebiggers@google.com>
This commit is contained in:
@@ -581,18 +581,8 @@ static bool update_fips140_library_routines(void)
|
||||
return ret == 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Initialize the FIPS 140 module.
|
||||
*
|
||||
* Note: this routine iterates over the contents of the initcall section, which
|
||||
* consists of an array of function pointers that was emitted by the linker
|
||||
* rather than the compiler. This means that these function pointers lack the
|
||||
* usual CFI stubs that the compiler emits when CFI codegen is enabled. So
|
||||
* let's disable CFI locally when handling the initcall array, to avoid
|
||||
* surpises.
|
||||
*/
|
||||
static int __init __attribute__((__no_sanitize__("cfi")))
|
||||
fips140_init(void)
|
||||
/* Initialize the FIPS 140 module */
|
||||
static int __init fips140_init(void)
|
||||
{
|
||||
const u32 *initcall;
|
||||
|
||||
@@ -605,7 +595,7 @@ fips140_init(void)
|
||||
for (initcall = __initcall_start + 1;
|
||||
initcall < &__initcall_end_marker;
|
||||
initcall++) {
|
||||
int (*init)(void) = offset_to_ptr(initcall);
|
||||
initcall_t init = offset_to_ptr(initcall);
|
||||
int err = init();
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user