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 | 7 | #include <linux/bug.h> |
| 8 | 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 | 12 | return !!((CPU_FTRS_ALWAYS & feature) || |
| 13 | 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 | 46 | return static_branch_likely(&cpu_feature_keys[i]); |
| 47 | 47 | } |
| 48 | 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 | 51 | return early_cpu_has_feature(feature); |
| 52 | 52 | } |
| @@ -65,3 +65,14 @@ V_FUNCTION_END(__kernel_clock_getres) · 64 unmodified lines | ||
| 65 | 65 | V_FUNCTION_BEGIN(__kernel_time) |
| 66 | 66 | cvdso_call_time __c_kernel_time |
| 67 | 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 | 34 | if (nbytes >= MAX_DRC_NAME_LEN) |
| 35 | 35 | return 0; |
| 36 | 36 | |
| 37 | − memcpy(drc_name, buf, nbytes); | |
| 37 | + strscpy(drc_name, buf, nbytes + 1); | |
| 38 | 38 | |
| 39 | 39 | end = strchr(drc_name, '\n'); |
| 40 | − if (!end) | |
| 41 | − end = &drc_name[nbytes]; | |
| 42 | − *end = '\0'; | |
| 40 | + if (end) | |
| 41 | + *end = '\0'; | |
| 43 | 42 | |
| 44 | 43 | rc = dlpar_add_slot(drc_name); |
| 45 | 44 | if (rc) |
| @@ -65,12 +64,11 @@ static ssize_t remove_slot_store(struct kobject *kobj, · 19 unmodified lines | ||
| 65 | 64 | if (nbytes >= MAX_DRC_NAME_LEN) |
| 66 | 65 | return 0; |
| 67 | 66 | |
| 68 | − memcpy(drc_name, buf, nbytes); | |
| 67 | + strscpy(drc_name, buf, nbytes + 1); | |
| 69 | 68 | |
| 70 | 69 | end = strchr(drc_name, '\n'); |
| 71 | − if (!end) | |
| 72 | − end = &drc_name[nbytes]; | |
| 73 | − *end = '\0'; | |
| 70 | + if (end) | |
| 71 | + *end = '\0'; | |
| 74 | 72 | |
| 75 | 73 | rc = dlpar_remove_slot(drc_name); |
| 76 | 74 | if (rc) |