Pull powerpc fixes from Michael Ellerman: - Fix a possible stack corruption and subsequent DLPAR failure in the rpadlpar_io PCI hotplug driver - Two build fixes for uncommon configurations Thanks to Christophe Leroy and Tyrel Datwyler. * tag 'powerpc-5.12-4' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux: PCI: rpadlpar: Fix potential drc_name corruption in store functions powerpc: Force inlining of cpu_has_feature() to avoid build failure powerpc/vdso32: Add missing _restgpr_31_x to fix build failure
Unified · Split
| @@ -7,7 +7,7 @@ · 6 unmodified lines | |||
| 7 | #include <linux/bug.h> | 7 | #include <linux/bug.h> |
| 8 | #include <asm/cputable.h> | 8 | #include <asm/cputable.h> |
| 9 | 9 | ||
| 10 | static inline bool early_cpu_has_feature(unsigned long feature) | 10 | static __always_inline bool early_cpu_has_feature(unsigned long feature) |
| 11 | { | 11 | { |
| 12 | return !!((CPU_FTRS_ALWAYS & feature) || | 12 | return !!((CPU_FTRS_ALWAYS & feature) || |
| 13 | (CPU_FTRS_POSSIBLE & cur_cpu_spec->cpu_features & feature)); | 13 | (CPU_FTRS_POSSIBLE & cur_cpu_spec->cpu_features & feature)); |
| @@ -46,7 +46,7 @@ static __always_inline bool cpu_has_feature(unsigned long feature) · 32 unmodified lines | |||
| 46 | return static_branch_likely(&cpu_feature_keys[i]); | 46 | return static_branch_likely(&cpu_feature_keys[i]); |
| 47 | } | 47 | } |
| 48 | #else | 48 | #else |
| 49 | static inline bool cpu_has_feature(unsigned long feature) | 49 | static __always_inline bool cpu_has_feature(unsigned long feature) |
| 50 | { | 50 | { |
| 51 | return early_cpu_has_feature(feature); | 51 | return early_cpu_has_feature(feature); |
| 52 | } | 52 | } |
| @@ -65,3 +65,14 @@ V_FUNCTION_END(__kernel_clock_getres) · 64 unmodified lines | |||
| 65 | V_FUNCTION_BEGIN(__kernel_time) | 65 | V_FUNCTION_BEGIN(__kernel_time) |
| 66 | cvdso_call_time __c_kernel_time | 66 | cvdso_call_time __c_kernel_time |
| 67 | V_FUNCTION_END(__kernel_time) | 67 | V_FUNCTION_END(__kernel_time) |
| 68 | |||
| 69 | /* Routines for restoring integer registers, called by the compiler. */ | ||
| 70 | /* Called with r11 pointing to the stack header word of the caller of the */ | ||
| 71 | /* function, just beyond the end of the integer restore area. */ | ||
| 72 | _GLOBAL(_restgpr_31_x) | ||
| 73 | _GLOBAL(_rest32gpr_31_x) | ||
| 74 | lwz r0,4(r11) | ||
| 75 | lwz r31,-4(r11) | ||
| 76 | mtlr r0 | ||
| 77 | mr r1,r11 | ||
| 78 | blr | ||
| @@ -34,12 +34,11 @@ static ssize_t add_slot_store(struct kobject *kobj, struct kobj_attribute *attr, · 33 unmodified lines | |||
| 34 | if (nbytes >= MAX_DRC_NAME_LEN) | 34 | if (nbytes >= MAX_DRC_NAME_LEN) |
| 35 | return 0; | 35 | return 0; |
| 36 | 36 | ||
| 37 | memcpy(drc_name, buf, nbytes); | 37 | strscpy(drc_name, buf, nbytes + 1); |
| 38 | 38 | ||
| 39 | end = strchr(drc_name, '\n'); | 39 | end = strchr(drc_name, '\n'); |
| 40 | if (!end) | 40 | if (end) |
| 41 | end = &drc_name[nbytes]; | 41 | *end = '\0'; |
| 42 | *end = '\0'; | ||
| 43 | 42 | ||
| 44 | rc = dlpar_add_slot(drc_name); | 43 | rc = dlpar_add_slot(drc_name); |
| 45 | if (rc) | 44 | if (rc) |
| @@ -65,12 +64,11 @@ static ssize_t remove_slot_store(struct kobject *kobj, · 19 unmodified lines | |||
| 65 | if (nbytes >= MAX_DRC_NAME_LEN) | 64 | if (nbytes >= MAX_DRC_NAME_LEN) |
| 66 | return 0; | 65 | return 0; |
| 67 | 66 | ||
| 68 | memcpy(drc_name, buf, nbytes); | 67 | strscpy(drc_name, buf, nbytes + 1); |
| 69 | 68 | ||
| 70 | end = strchr(drc_name, '\n'); | 69 | end = strchr(drc_name, '\n'); |
| 71 | if (!end) | 70 | if (end) |
| 72 | end = &drc_name[nbytes]; | 71 | *end = '\0'; |
| 73 | *end = '\0'; | ||
| 74 | 72 | ||
| 75 | rc = dlpar_remove_slot(drc_name); | 73 | rc = dlpar_remove_slot(drc_name); |
| 76 | if (rc) | 74 | if (rc) |