treewide: remove redundant IS_ERR() before error code check
[linux/fpc-iii.git] / arch / powerpc / include / asm / stackprotector.h
blob1c8460e235838ccfe7ee23c59a1854f438d5efa0
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3 * GCC stack protector support.
5 */
7 #ifndef _ASM_STACKPROTECTOR_H
8 #define _ASM_STACKPROTECTOR_H
10 #include <linux/random.h>
11 #include <linux/version.h>
12 #include <asm/reg.h>
13 #include <asm/current.h>
14 #include <asm/paca.h>
17 * Initialize the stackprotector canary value.
19 * NOTE: this must only be called from functions that never return,
20 * and it must always be inlined.
22 static __always_inline void boot_init_stack_canary(void)
24 unsigned long canary;
26 /* Try to get a semi random initial value. */
27 canary = get_random_canary();
28 canary ^= mftb();
29 canary ^= LINUX_VERSION_CODE;
30 canary &= CANARY_MASK;
32 current->stack_canary = canary;
33 #ifdef CONFIG_PPC64
34 get_paca()->canary = canary;
35 #endif
38 #endif /* _ASM_STACKPROTECTOR_H */