[PATCH] powerpc: Use str_plural() to fix Coccinelle warning
Fixes the following Coccinelle/coccicheck warning reported by string_choices.cocci: opportunity for str_plural(tpc) Signed-off-by: Thorsten Blum --- arch/powerpc/kernel/setup-common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c index 01ed1263e1a9..4bd2f87616ba 100644 --- a/arch/powerpc/kernel/setup-common.c +++ b/arch/powerpc/kernel/setup-common.c @@ -405,7 +405,7 @@ static void __init cpu_init_thread_core_maps(int tpc) cpumask_set_cpu(i, &threads_core_mask); printk(KERN_INFO "CPU maps initialized for %d thread%s per core\n", - tpc, tpc > 1 ? "s" : ""); + tpc, str_plural(tpc)); printk(KERN_DEBUG " (thread shift is %d)\n", threads_shift); } -- 2.44.0
[PATCH] powerpc: Use str_enabled_disabled() helper function
Remove hard-coded strings by using the str_enabled_disabled() helper function. Signed-off-by: Thorsten Blum --- arch/powerpc/kernel/secure_boot.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/kernel/secure_boot.c b/arch/powerpc/kernel/secure_boot.c index 9e0efb657f39..3a28795b4ed8 100644 --- a/arch/powerpc/kernel/secure_boot.c +++ b/arch/powerpc/kernel/secure_boot.c @@ -5,6 +5,7 @@ */ #include #include +#include #include static struct device_node *get_ppc_fw_sb_node(void) @@ -38,7 +39,7 @@ bool is_ppc_secureboot_enabled(void) of_node_put(node); out: - pr_info("Secure boot mode %s\n", enabled ? "enabled" : "disabled"); + pr_info("Secure boot mode %s\n", str_enabled_disabled(enabled)); return enabled; } @@ -62,7 +63,7 @@ bool is_ppc_trustedboot_enabled(void) of_node_put(node); out: - pr_info("Trusted boot mode %s\n", enabled ? "enabled" : "disabled"); + pr_info("Trusted boot mode %s\n", str_enabled_disabled(enabled)); return enabled; } -- 2.47.0
Re: [PATCH] powerpc: Transliterate author name and remove FIXME
On 11. Nov 2024, at 02:11, Michael Ellerman wrote: > Thorsten Blum writes: >> The name is Mimi Phuong-Thao Vo. > > Is that the correct spelling? According to [1] it's correct. Thanks, Thorsten [1] https://www.linkedin.com/in/mimi-phuong-thao-vo-5768033
[PATCH] powerpc: Transliterate author name and remove FIXME
The name is Mimi Phuong-Thao Vo. Signed-off-by: Thorsten Blum --- arch/powerpc/boot/rs6000.h | 6 +- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/arch/powerpc/boot/rs6000.h b/arch/powerpc/boot/rs6000.h index a9d879155ef9..16df8f3c43f1 100644 --- a/arch/powerpc/boot/rs6000.h +++ b/arch/powerpc/boot/rs6000.h @@ -1,11 +1,7 @@ /* SPDX-License-Identifier: GPL-2.0 */ /* IBM RS/6000 "XCOFF" file definitions for BFD. Copyright (C) 1990, 1991 Free Software Foundation, Inc. - FIXME: Can someone provide a transliteration of this name into ASCII? - Using the following chars caused a compiler warning on HIUX (so I replaced - them with octal escapes), and isn't useful without an understanding of what - character set it is. - Written by Mimi Ph\373\364ng-Th\345o V\365 of IBM + Written by Mimi Phuong-Thao Vo of IBM and John Gilmore of Cygnus Support. */ /** FILE HEADER **/ -- 2.47.0
[PATCH] powerpc/xmon: Use str_yes_no() helper in dump_one_paca()
Remove hard-coded strings by using the str_yes_no() helper function. Signed-off-by: Thorsten Blum --- arch/powerpc/xmon/xmon.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c index e6cddbb2305f..6c84169b309d 100644 --- a/arch/powerpc/xmon/xmon.c +++ b/arch/powerpc/xmon/xmon.c @@ -2623,9 +2623,9 @@ static void dump_one_paca(int cpu) printf("paca for cpu 0x%x @ %px:\n", cpu, p); - printf(" %-*s = %s\n", 25, "possible", cpu_possible(cpu) ? "yes" : "no"); - printf(" %-*s = %s\n", 25, "present", cpu_present(cpu) ? "yes" : "no"); - printf(" %-*s = %s\n", 25, "online", cpu_online(cpu) ? "yes" : "no"); + printf(" %-*s = %s\n", 25, "possible", str_yes_no(cpu_possible(cpu))); + printf(" %-*s = %s\n", 25, "present", str_yes_no(cpu_present(cpu))); + printf(" %-*s = %s\n", 25, "online", str_yes_no(cpu_online(cpu))); #define DUMP(paca, name, format) \ printf(" %-*s = "format"\t(0x%lx)\n", 25, #name, 18, paca->name, \ -- 2.47.0
Re: [PATCH] powerpc: Transliterate author name and remove FIXME
On 11. Nov 2024, at 02:11, Michael Ellerman wrote: > Thorsten Blum writes: >> The name is Mimi Phuong-Thao Vo. > > Is that the correct spelling? > > The github commit below suggests it's Mimi Phûông-Thåo Võ. > > And presumably the author preferred that spelling, otherwise they would > have just written it in ASCII in the first place. > > https://github.com/bminor/binutils-gdb/commit/6603bf38d74409906b3814f6a26c0483a5d32e41 Hi Michael, Are you suggesting to keep "Mimi Ph\373\364ng-Th\345o V\365" and a FIXME instead of changing it to "Mimi Phuong-Thao Vo" which is how she spells her name on her LinkedIn profile and other websites? I doubt anyone prefers their name to be spelled with octal escape characters. Thanks, Thorsten
Re: [PATCH] powerpc: Transliterate author name and remove FIXME
On 23. Nov 2024, at 11:19, Christophe Leroy wrote: > Isn't our file just a copy of the one from binutils ? Shouldn't we adjust it > based on commit https://github.com/bminor/binutils-gdb/commit/2ce18a16268a ? It looks like it's a copy and the name is spelled the same as in my patch: "Mimi Phuong-Thao Vo" What's missing to get this merged? Thanks, Thorsten
[PATCH] fadump: Use str_yes_no() helper in fadump_show_config()
Remove hard-coded strings by using the str_yes_no() helper function. Signed-off-by: Thorsten Blum --- arch/powerpc/kernel/fadump.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/arch/powerpc/kernel/fadump.c b/arch/powerpc/kernel/fadump.c index 4b371c738213..8c531533dd3e 100644 --- a/arch/powerpc/kernel/fadump.c +++ b/arch/powerpc/kernel/fadump.c @@ -289,10 +289,8 @@ static void __init fadump_show_config(void) if (!fw_dump.fadump_supported) return; - pr_debug("Fadump enabled: %s\n", - (fw_dump.fadump_enabled ? "yes" : "no")); - pr_debug("Dump Active : %s\n", - (fw_dump.dump_active ? "yes" : "no")); + pr_debug("Fadump enabled: %s\n", str_yes_no(fw_dump.fadump_enabled)); + pr_debug("Dump Active : %s\n", str_yes_no(fw_dump.dump_active)); pr_debug("Dump section sizes:\n"); pr_debug("CPU state data size: %lx\n", fw_dump.cpu_state_data_size); pr_debug("HPTE region size : %lx\n", fw_dump.hpte_region_size); -- 2.47.1
[PATCH] powerpc: mpic: Use str_enabled_disabled() helper function
Remove hard-coded strings by using the str_enabled_disabled() helper function. Use pr_debug() instead of printk(KERN_DEBUG) to silence a checkpatch warning. Signed-off-by: Thorsten Blum --- arch/powerpc/sysdev/mpic.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/arch/powerpc/sysdev/mpic.c b/arch/powerpc/sysdev/mpic.c index d94cf36b0f65..25fc4ac91814 100644 --- a/arch/powerpc/sysdev/mpic.c +++ b/arch/powerpc/sysdev/mpic.c @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include @@ -474,9 +475,9 @@ static void __init mpic_scan_ht_msi(struct mpic *mpic, u8 __iomem *devbase, addr = addr | ((u64)readl(base + HT_MSI_ADDR_HI) << 32); } - printk(KERN_DEBUG "mpic: - HT:%02x.%x %s MSI mapping found @ 0x%llx\n", - PCI_SLOT(devfn), PCI_FUNC(devfn), - flags & HT_MSI_FLAGS_ENABLE ? "enabled" : "disabled", addr); + pr_debug("mpic: - HT:%02x.%x %s MSI mapping found @ 0x%llx\n", +PCI_SLOT(devfn), PCI_FUNC(devfn), +str_enabled_disabled(flags & HT_MSI_FLAGS_ENABLE), addr); if (!(flags & HT_MSI_FLAGS_ENABLE)) writeb(flags | HT_MSI_FLAGS_ENABLE, base + HT_MSI_FLAGS); -- 2.48.0
[PATCH] powerpc/mm/fault: Use str_write_read() helper function
Remove hard-coded strings by using the str_write_read() helper function. Signed-off-by: Thorsten Blum --- arch/powerpc/mm/fault.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/mm/fault.c b/arch/powerpc/mm/fault.c index c156fe0d53c3..806c74e0d5ab 100644 --- a/arch/powerpc/mm/fault.c +++ b/arch/powerpc/mm/fault.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -218,7 +219,7 @@ static bool bad_kernel_fault(struct pt_regs *regs, unsigned long error_code, // Read/write fault blocked by KUAP is bad, it can never succeed. if (bad_kuap_fault(regs, address, is_write)) { pr_crit_ratelimited("Kernel attempted to %s user page (%lx) - exploit attempt? (uid: %d)\n", - is_write ? "write" : "read", address, + str_write_read(is_write), address, from_kuid(&init_user_ns, current_uid())); // Fault on user outside of certain regions (eg. copy_tofrom_user()) is bad @@ -625,7 +626,7 @@ static void __bad_page_fault(struct pt_regs *regs, int sig) case INTERRUPT_DATA_STORAGE: case INTERRUPT_H_DATA_STORAGE: pr_alert("BUG: %s on %s at 0x%08lx\n", msg, -is_write ? "write" : "read", regs->dar); +str_write_read(is_write), regs->dar); break; case INTERRUPT_DATA_SEGMENT: pr_alert("BUG: %s at 0x%08lx\n", msg, regs->dar); -- 2.48.0
Re: [RESEND PATCH] fadump: Use str_yes_no() helper in fadump_show_config()
On 9. Feb 2025, at 10:16, Christophe Leroy wrote: > Le 09/02/2025 à 09:17, Thorsten Blum a écrit : >> Remove hard-coded strings by using the str_yes_no() helper function. >> Reviewed-by: Sourabh Jain >> Reviewed-by: Ritesh Harjani (IBM) >> Signed-off-by: Thorsten Blum > > Any reason for resending ? Your patch is not lost, see > https://patchwork.ozlabs.org/project/linuxppc-dev/list/?submitter=89400 Ah sorry, I missed this. It's sometimes hard to know the status of a patch when it's not in next yet. Thanks, Thorsten
[PATCH] powerpc/ps3: Use str_write_read() in ps3_notification_read_write()
Remove hard-coded strings by using the str_write_read() helper function. Signed-off-by: Thorsten Blum Suggested-by: Christophe Leroy --- arch/powerpc/platforms/ps3/device-init.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/platforms/ps3/device-init.c b/arch/powerpc/platforms/ps3/device-init.c index 61722133eb2d..22d91ac424dd 100644 --- a/arch/powerpc/platforms/ps3/device-init.c +++ b/arch/powerpc/platforms/ps3/device-init.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include @@ -724,7 +725,7 @@ static irqreturn_t ps3_notification_interrupt(int irq, void *data) static int ps3_notification_read_write(struct ps3_notification_device *dev, u64 lpar, int write) { - const char *op = write ? "write" : "read"; + const char *op = str_write_read(write); unsigned long flags; int res; -- 2.48.1
[PATCH] powerpc/iommu: Use str_disabled_enabled() helper
Remove hard-coded strings by using the str_disabled_enabled() helper. Signed-off-by: Thorsten Blum --- arch/powerpc/kernel/iommu.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/kernel/iommu.c b/arch/powerpc/kernel/iommu.c index 0ebae6e4c19d..244eb4857e7f 100644 --- a/arch/powerpc/kernel/iommu.c +++ b/arch/powerpc/kernel/iommu.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -769,8 +770,8 @@ struct iommu_table *iommu_init_table(struct iommu_table *tbl, int nid, iommu_table_clear(tbl); if (!welcomed) { - printk(KERN_INFO "IOMMU table initialized, virtual merging %s\n", - novmerge ? "disabled" : "enabled"); + pr_info("IOMMU table initialized, virtual merging %s\n", + str_disabled_enabled(novmerge)); welcomed = 1; } -- 2.48.0
Re: [PATCH] powerpc: Transliterate author name and remove FIXME
On 7. Jan 2025, at 13:16, Thorsten Blum wrote: > On 23. Nov 2024, at 11:19, Christophe Leroy wrote: >> Isn't our file just a copy of the one from binutils ? Shouldn't we adjust it >> based on commit https://github.com/bminor/binutils-gdb/commit/2ce18a16268a ? > > It looks like it's a copy and the name is spelled the same as in my patch: > > "Mimi Phuong-Thao Vo" > > What's missing to get this merged? Anyone? Thanks, Thorsten
[PATCH] powerpc: Use str_on_off() helper in check_cache_coherency()
Remove hard-coded strings by using the str_on_off() helper function. Signed-off-by: Thorsten Blum --- arch/powerpc/kernel/setup-common.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c index 6fa179448c33..f7d7a93f07fc 100644 --- a/arch/powerpc/kernel/setup-common.c +++ b/arch/powerpc/kernel/setup-common.c @@ -834,8 +834,8 @@ static int __init check_cache_coherency(void) if (devtree_coherency != KERNEL_COHERENCY) { printk(KERN_ERR "kernel coherency:%s != device tree_coherency:%s\n", - KERNEL_COHERENCY ? "on" : "off", - devtree_coherency ? "on" : "off"); + str_on_off(KERNEL_COHERENCY), + str_on_off(devtree_coherency)); BUG(); } -- 2.47.1
[RESEND PATCH] powerpc: Use str_on_off() helper in check_cache_coherency()
Remove hard-coded strings by using the str_on_off() helper function. Signed-off-by: Thorsten Blum --- arch/powerpc/kernel/setup-common.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c index 6fa179448c33..f7d7a93f07fc 100644 --- a/arch/powerpc/kernel/setup-common.c +++ b/arch/powerpc/kernel/setup-common.c @@ -834,8 +834,8 @@ static int __init check_cache_coherency(void) if (devtree_coherency != KERNEL_COHERENCY) { printk(KERN_ERR "kernel coherency:%s != device tree_coherency:%s\n", - KERNEL_COHERENCY ? "on" : "off", - devtree_coherency ? "on" : "off"); + str_on_off(KERNEL_COHERENCY), + str_on_off(devtree_coherency)); BUG(); } -- 2.47.1
[PATCH] powerpc/powermac: Use str_enabled_disabled() and str_on_off() helpers
Remove hard-coded strings by using the str_enabled_disabled() and str_on_off() helper functions. Signed-off-by: Thorsten Blum --- arch/powerpc/platforms/powermac/setup.c | 4 ++-- arch/powerpc/platforms/powermac/time.c | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/arch/powerpc/platforms/powermac/setup.c b/arch/powerpc/platforms/powermac/setup.c index 6de1cd5d8a58..e119ced05d10 100644 --- a/arch/powerpc/platforms/powermac/setup.c +++ b/arch/powerpc/platforms/powermac/setup.c @@ -45,6 +45,7 @@ #include #include #include +#include #include #include @@ -238,8 +239,7 @@ static void __init l2cr_init(void) _set_L2CR(0); _set_L2CR(*l2cr); pr_info("L2CR overridden (0x%x), backside cache is %s\n", - *l2cr, ((*l2cr) & 0x8000) ? - "enabled" : "disabled"); + *l2cr, str_enabled_disabled((*l2cr) & 0x8000)); } of_node_put(np); break; diff --git a/arch/powerpc/platforms/powermac/time.c b/arch/powerpc/platforms/powermac/time.c index 8633891b7aa5..b4426a35aca3 100644 --- a/arch/powerpc/platforms/powermac/time.c +++ b/arch/powerpc/platforms/powermac/time.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -77,7 +78,7 @@ long __init pmac_time_init(void) delta |= 0xFF00UL; dst = ((pmac_xpram_read(PMAC_XPRAM_MACHINE_LOC + 0x8) & 0x80) != 0); printk("GMT Delta read from XPRAM: %d minutes, DST: %s\n", delta/60, - dst ? "on" : "off"); + str_on_off(dst)); #endif return delta; } -- 2.48.0
[RESEND PATCH] fadump: Use str_yes_no() helper in fadump_show_config()
Remove hard-coded strings by using the str_yes_no() helper function. Reviewed-by: Sourabh Jain Reviewed-by: Ritesh Harjani (IBM) Signed-off-by: Thorsten Blum --- arch/powerpc/kernel/fadump.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/arch/powerpc/kernel/fadump.c b/arch/powerpc/kernel/fadump.c index 4b371c738213..8c531533dd3e 100644 --- a/arch/powerpc/kernel/fadump.c +++ b/arch/powerpc/kernel/fadump.c @@ -289,10 +289,8 @@ static void __init fadump_show_config(void) if (!fw_dump.fadump_supported) return; - pr_debug("Fadump enabled: %s\n", - (fw_dump.fadump_enabled ? "yes" : "no")); - pr_debug("Dump Active : %s\n", - (fw_dump.dump_active ? "yes" : "no")); + pr_debug("Fadump enabled: %s\n", str_yes_no(fw_dump.fadump_enabled)); + pr_debug("Dump Active : %s\n", str_yes_no(fw_dump.dump_active)); pr_debug("Dump section sizes:\n"); pr_debug("CPU state data size: %lx\n", fw_dump.cpu_state_data_size); pr_debug("HPTE region size : %lx\n", fw_dump.hpte_region_size); -- 2.48.1
[RESEND PATCH] KVM: powerpc: Enable commented out BUILD_BUG_ON() assertion
The BUILD_BUG_ON() assertion was commented out in commit 38634e676992 ("powerpc/kvm: Remove problematic BUILD_BUG_ON statement") and fixed in commit c0a187e12d48 ("KVM: powerpc: Fix BUILD_BUG_ON condition"), but not enabled. Enable it now that this no longer breaks and remove the comment. Signed-off-by: Thorsten Blum --- arch/powerpc/kvm/timing.h | 4 1 file changed, 4 deletions(-) diff --git a/arch/powerpc/kvm/timing.h b/arch/powerpc/kvm/timing.h index 45817ab82bb4..14b0e23f601f 100644 --- a/arch/powerpc/kvm/timing.h +++ b/arch/powerpc/kvm/timing.h @@ -38,11 +38,7 @@ static inline void kvmppc_set_exit_type(struct kvm_vcpu *vcpu, int type) {} static inline void kvmppc_account_exit_stat(struct kvm_vcpu *vcpu, int type) { /* type has to be known at build time for optimization */ - - /* The BUILD_BUG_ON below breaks in funny ways, commented out -* for now ... -BenH BUILD_BUG_ON(!__builtin_constant_p(type)); - */ switch (type) { case EXT_INTR_EXITS: vcpu->stat.ext_intr_exits++; -- 2.49.0
[RESEND PATCH] powerpc/ps3: Use str_write_read() in ps3_notification_read_write()
Remove hard-coded strings by using the str_write_read() helper function. Suggested-by: Christophe Leroy Reviewed-by: Geert Uytterhoeven Signed-off-by: Thorsten Blum --- arch/powerpc/platforms/ps3/device-init.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/platforms/ps3/device-init.c b/arch/powerpc/platforms/ps3/device-init.c index 61722133eb2d..22d91ac424dd 100644 --- a/arch/powerpc/platforms/ps3/device-init.c +++ b/arch/powerpc/platforms/ps3/device-init.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include @@ -724,7 +725,7 @@ static irqreturn_t ps3_notification_interrupt(int irq, void *data) static int ps3_notification_read_write(struct ps3_notification_device *dev, u64 lpar, int write) { - const char *op = write ? "write" : "read"; + const char *op = str_write_read(write); unsigned long flags; int res; -- 2.49.0
[PATCH] bus: fsl-mc: Use strscpy() instead of strscpy_pad()
Both destination buffers are already zero-initialized, making strscpy() sufficient for safely copying 'obj_type'. The additional NUL-padding performed by strscpy_pad() is unnecessary. If the destination buffer has a fixed length, strscpy() automatically determines its size using sizeof() when the argument is omitted. This makes the explicit size arguments unnecessary. No functional changes intended. Signed-off-by: Thorsten Blum --- drivers/bus/fsl-mc/dprc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/bus/fsl-mc/dprc.c b/drivers/bus/fsl-mc/dprc.c index dd1b5c0fb7e2..38d40c09b719 100644 --- a/drivers/bus/fsl-mc/dprc.c +++ b/drivers/bus/fsl-mc/dprc.c @@ -489,7 +489,7 @@ int dprc_set_obj_irq(struct fsl_mc_io *mc_io, cmd_params->irq_addr = cpu_to_le64(irq_cfg->paddr); cmd_params->irq_num = cpu_to_le32(irq_cfg->irq_num); cmd_params->obj_id = cpu_to_le32(obj_id); - strscpy_pad(cmd_params->obj_type, obj_type, 16); + strscpy(cmd_params->obj_type, obj_type); /* send command to mc*/ return mc_send_command(mc_io, &cmd); @@ -561,7 +561,7 @@ int dprc_get_obj_region(struct fsl_mc_io *mc_io, cmd_params = (struct dprc_cmd_get_obj_region *)cmd.params; cmd_params->obj_id = cpu_to_le32(obj_id); cmd_params->region_index = region_index; - strscpy_pad(cmd_params->obj_type, obj_type, 16); + strscpy(cmd_params->obj_type, obj_type); /* send command to mc*/ err = mc_send_command(mc_io, &cmd); -- 2.49.0
Re: [RESEND PATCH] bus: fsl-mc: Use strscpy() instead of strscpy_pad()
Hi Christophe, On 29. Apr 2025, at 13:58, Christophe Leroy wrote: > Le 29/04/2025 à 13:47, Ioana Ciornei a écrit: >> On Tue, Apr 29, 2025 at 12:41:48PM +0200, Thorsten Blum wrote: >>> Both destination buffers are already zero-initialized, making strscpy() >>> sufficient for safely copying 'obj_type'. The additional NUL-padding >>> performed by strscpy_pad() is unnecessary. >>> >>> If the destination buffer has a fixed length, strscpy() automatically >>> determines its size using sizeof() when the argument is omitted. This >>> makes the explicit size arguments unnecessary. >>> >>> No functional changes intended. >>> >>> Signed-off-by: Thorsten Blum >> Reviewed-by: Ioana Ciornei >> Christophe, could you also pick-up this patch when you have a chance? > > Sure I will take it when time comes, but again I'd expect an explanation > inside the patch (below the ---) for the resend. I now have this patch twice > in the list and don't know why, see > https://patchwork.ozlabs.org/project/linuxppc-dev/list/?series=&submitter=&state=&q=&archive=&delegate=61610 A "resend" is meant as a "ping" and the patch is always unmodified, at least that's my understanding of it. So there's no particular reason other than: "Did you see my patch? Let me send it again just to be sure you didn't miss it." From [1]: "Don’t add “RESEND” when you are submitting a modified version of your patch or patch series - “RESEND” only applies to resubmission of a patch or patch series which have not been modified in any way from the previous submission." The patches are identical - just pick one. Thanks, Thorsten [1] https://www.kernel.org/doc/html/latest/process/submitting-patches.html#don-t-get-discouraged-or-impatient
[RESEND PATCH] bus: fsl-mc: Use strscpy() instead of strscpy_pad()
Both destination buffers are already zero-initialized, making strscpy() sufficient for safely copying 'obj_type'. The additional NUL-padding performed by strscpy_pad() is unnecessary. If the destination buffer has a fixed length, strscpy() automatically determines its size using sizeof() when the argument is omitted. This makes the explicit size arguments unnecessary. No functional changes intended. Signed-off-by: Thorsten Blum --- drivers/bus/fsl-mc/dprc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/bus/fsl-mc/dprc.c b/drivers/bus/fsl-mc/dprc.c index dd1b5c0fb7e2..38d40c09b719 100644 --- a/drivers/bus/fsl-mc/dprc.c +++ b/drivers/bus/fsl-mc/dprc.c @@ -489,7 +489,7 @@ int dprc_set_obj_irq(struct fsl_mc_io *mc_io, cmd_params->irq_addr = cpu_to_le64(irq_cfg->paddr); cmd_params->irq_num = cpu_to_le32(irq_cfg->irq_num); cmd_params->obj_id = cpu_to_le32(obj_id); - strscpy_pad(cmd_params->obj_type, obj_type, 16); + strscpy(cmd_params->obj_type, obj_type); /* send command to mc*/ return mc_send_command(mc_io, &cmd); @@ -561,7 +561,7 @@ int dprc_get_obj_region(struct fsl_mc_io *mc_io, cmd_params = (struct dprc_cmd_get_obj_region *)cmd.params; cmd_params->obj_id = cpu_to_le32(obj_id); cmd_params->region_index = region_index; - strscpy_pad(cmd_params->obj_type, obj_type, 16); + strscpy(cmd_params->obj_type, obj_type); /* send command to mc*/ err = mc_send_command(mc_io, &cmd); -- 2.49.0
[PATCH] powerpc: Replace strcpy() with strscpy() in proc_ppc64_init()
strcpy() is deprecated; use strscpy() instead. Don't cast the destination buffer from 'u8[]' to 'char *' to satisfy the __must_be_array() requirement of strscpy(). No functional changes intended. Link: https://github.com/KSPP/linux/issues/88 Cc: linux-harden...@vger.kernel.org Signed-off-by: Thorsten Blum --- arch/powerpc/kernel/proc_powerpc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/kernel/proc_powerpc.c b/arch/powerpc/kernel/proc_powerpc.c index 3816a2bf2b84..d083b4517065 100644 --- a/arch/powerpc/kernel/proc_powerpc.c +++ b/arch/powerpc/kernel/proc_powerpc.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include @@ -56,7 +57,7 @@ static int __init proc_ppc64_init(void) { struct proc_dir_entry *pde; - strcpy((char *)systemcfg->eye_catcher, "SYSTEMCFG:PPC64"); + strscpy(systemcfg->eye_catcher, "SYSTEMCFG:PPC64"); systemcfg->version.major = SYSTEMCFG_MAJOR; systemcfg->version.minor = SYSTEMCFG_MINOR; systemcfg->processor = mfspr(SPRN_PVR); -- 2.49.0
[RESEND PATCH] powerpc/ps3: Use str_write_read() in ps3_notification_read_write()
Remove hard-coded strings by using the str_write_read() helper function. Suggested-by: Christophe Leroy Signed-off-by: Thorsten Blum --- arch/powerpc/platforms/ps3/device-init.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/platforms/ps3/device-init.c b/arch/powerpc/platforms/ps3/device-init.c index 61722133eb2d..22d91ac424dd 100644 --- a/arch/powerpc/platforms/ps3/device-init.c +++ b/arch/powerpc/platforms/ps3/device-init.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include @@ -724,7 +725,7 @@ static irqreturn_t ps3_notification_interrupt(int irq, void *data) static int ps3_notification_read_write(struct ps3_notification_device *dev, u64 lpar, int write) { - const char *op = write ? "write" : "read"; + const char *op = str_write_read(write); unsigned long flags; int res; -- 2.48.1
[RESEND PATCH] powerpc: mpic: Use str_enabled_disabled() helper function
Remove hard-coded strings by using the str_enabled_disabled() helper function. Use pr_debug() instead of printk(KERN_DEBUG) to silence a checkpatch warning. Reviewed-by: Ricardo B. Marlière Signed-off-by: Thorsten Blum --- arch/powerpc/sysdev/mpic.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/arch/powerpc/sysdev/mpic.c b/arch/powerpc/sysdev/mpic.c index d94cf36b0f65..25fc4ac91814 100644 --- a/arch/powerpc/sysdev/mpic.c +++ b/arch/powerpc/sysdev/mpic.c @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include @@ -474,9 +475,9 @@ static void __init mpic_scan_ht_msi(struct mpic *mpic, u8 __iomem *devbase, addr = addr | ((u64)readl(base + HT_MSI_ADDR_HI) << 32); } - printk(KERN_DEBUG "mpic: - HT:%02x.%x %s MSI mapping found @ 0x%llx\n", - PCI_SLOT(devfn), PCI_FUNC(devfn), - flags & HT_MSI_FLAGS_ENABLE ? "enabled" : "disabled", addr); + pr_debug("mpic: - HT:%02x.%x %s MSI mapping found @ 0x%llx\n", +PCI_SLOT(devfn), PCI_FUNC(devfn), +str_enabled_disabled(flags & HT_MSI_FLAGS_ENABLE), addr); if (!(flags & HT_MSI_FLAGS_ENABLE)) writeb(flags | HT_MSI_FLAGS_ENABLE, base + HT_MSI_FLAGS); -- 2.48.1
[PATCH] KVM: powerpc: Enable commented out BUILD_BUG_ON() assertion
The BUILD_BUG_ON() assertion was commented out in commit 38634e676992 ("powerpc/kvm: Remove problematic BUILD_BUG_ON statement") and fixed in commit c0a187e12d48 ("KVM: powerpc: Fix BUILD_BUG_ON condition"), but not enabled. Enable it now that this no longer breaks and remove the comment. Signed-off-by: Thorsten Blum --- arch/powerpc/kvm/timing.h | 4 1 file changed, 4 deletions(-) diff --git a/arch/powerpc/kvm/timing.h b/arch/powerpc/kvm/timing.h index 45817ab82bb4..14b0e23f601f 100644 --- a/arch/powerpc/kvm/timing.h +++ b/arch/powerpc/kvm/timing.h @@ -38,11 +38,7 @@ static inline void kvmppc_set_exit_type(struct kvm_vcpu *vcpu, int type) {} static inline void kvmppc_account_exit_stat(struct kvm_vcpu *vcpu, int type) { /* type has to be known at build time for optimization */ - - /* The BUILD_BUG_ON below breaks in funny ways, commented out -* for now ... -BenH BUILD_BUG_ON(!__builtin_constant_p(type)); - */ switch (type) { case EXT_INTR_EXITS: vcpu->stat.ext_intr_exits++; -- 2.48.1
[PATCH] ASoC: fsl: fsl_qmc_audio: Remove unnecessary bool conversions
Remove unnecessary bool conversions and simplify the code. Signed-off-by: Thorsten Blum --- sound/soc/fsl/fsl_qmc_audio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sound/soc/fsl/fsl_qmc_audio.c b/sound/soc/fsl/fsl_qmc_audio.c index e257b8adafe0..b2979290c973 100644 --- a/sound/soc/fsl/fsl_qmc_audio.c +++ b/sound/soc/fsl/fsl_qmc_audio.c @@ -892,7 +892,7 @@ static int qmc_audio_dai_parse(struct qmc_audio *qmc_audio, struct device_node * qmc_soc_dai_driver->playback.channels_max = count > 1 ? count : nb_tx_ts; } qmc_soc_dai_driver->playback.formats = qmc_audio_formats(nb_tx_ts, -count > 1 ? true : false); +count > 1); qmc_soc_dai_driver->capture.channels_min = 0; qmc_soc_dai_driver->capture.channels_max = 0; @@ -901,7 +901,7 @@ static int qmc_audio_dai_parse(struct qmc_audio *qmc_audio, struct device_node * qmc_soc_dai_driver->capture.channels_max = count > 1 ? count : nb_rx_ts; } qmc_soc_dai_driver->capture.formats = qmc_audio_formats(nb_rx_ts, - count > 1 ? true : false); + count > 1); qmc_soc_dai_driver->playback.rates = snd_pcm_rate_to_rate_bit(tx_fs_rate); qmc_soc_dai_driver->playback.rate_min = tx_fs_rate; -- 2.48.1
Re: [RESEND PATCH] powerpc: mpic: Use str_enabled_disabled() helper function
Hi Christophe, > On 24. Feb 2025, at 13:56, Christophe Leroy wrote: > Le 19/02/2025 à 12:20, Thorsten Blum a écrit : >> Remove hard-coded strings by using the str_enabled_disabled() helper >> function. >> Use pr_debug() instead of printk(KERN_DEBUG) to silence a checkpatch >> warning. >> Reviewed-by: Ricardo B. Marlière >> Signed-off-by: Thorsten Blum >> --- > > When you resend a patch, please tell why here (below the ---) so that we know > the reason. A "resend" is meant as a "ping" and the patch is always unmodified. From [1]: "Don’t add “RESEND” when you are submitting a modified version of your patch or patch series - “RESEND” only applies to resubmission of a patch or patch series which have not been modified in any way from the previous submission." When a patch is not in -next yet or when it's been a week or longer and I haven't received any feedback, I eventually follow up on it by resending the same patch. You're the first one to ask for a reason for resending. > At the time being I have several duplicated patches from you and I don't know > what to do with them which one to keep and which one to drop. They're the same - feel free to pick the original patch or the resend. Thanks, Thorsten [1] https://www.kernel.org/doc/html/latest/process/submitting-patches.html#don-t-get-discouraged-or-impatient
Re: [PATCH] powerpc: Transliterate author name and remove FIXME
On 7. Jan 2025, at 13:16, Thorsten Blum wrote: > On 23. Nov 2024, at 11:19, Christophe Leroy wrote: >> Isn't our file just a copy of the one from binutils ? Shouldn't we adjust it >> based on commit https://github.com/bminor/binutils-gdb/commit/2ce18a16268a ? > > It looks like it's a copy and the name is spelled the same as in my patch: > > "Mimi Phuong-Thao Vo" > > What's missing to get this merged? Does it make sense to resubmit this or do we leave the name and the FIXME as is? Thanks, Thorsten
[PATCH] powerpc/rtas: Replace one-element array with flexible array member
Replace the deprecated one-element array with a modern flexible array member in the struct rtas_error_log and add the __counted_by_be() compiler attribute to improve access bounds-checking via CONFIG_UBSAN_BOUNDS and CONFIG_FORTIFY_SOURCE. No functional changes intended. Link: https://github.com/KSPP/linux/issues/79 Link: https://github.com/KSPP/linux/issues/83 Signed-off-by: Thorsten Blum --- arch/powerpc/include/asm/rtas-types.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/include/asm/rtas-types.h b/arch/powerpc/include/asm/rtas-types.h index 9d5b16803cbb..5d40d187b965 100644 --- a/arch/powerpc/include/asm/rtas-types.h +++ b/arch/powerpc/include/asm/rtas-types.h @@ -42,8 +42,9 @@ struct rtas_error_log { */ u8 byte3; /* General event or error*/ __be32 extended_log_length;/* length in bytes */ - unsigned char buffer[1]; /* Start of extended log */ - /* Variable length. */ + + /* Start of extended log, variable length */ + unsigned char buffer[] __counted_by_be(extended_log_length); }; /* RTAS general extended event log, Version 6. The extended log starts -- 2.49.0
[PATCH] powerpc: Fix indentation and replace typedef with struct name
Indent several struct members using tabs instead of spaces. Replace the typedef alias AOUTHDR with an explicit struct name to silence a checkpatch warning. Signed-off-by: Thorsten Blum --- arch/powerpc/boot/hack-coff.c | 2 +- arch/powerpc/boot/rs6000.h| 84 +-- 2 files changed, 41 insertions(+), 45 deletions(-) diff --git a/arch/powerpc/boot/hack-coff.c b/arch/powerpc/boot/hack-coff.c index a010e124ac4b..6bf0c94302f5 100644 --- a/arch/powerpc/boot/hack-coff.c +++ b/arch/powerpc/boot/hack-coff.c @@ -31,7 +31,7 @@ main(int ac, char **av) int i, nsect; int aoutsz; struct external_filehdr fhdr; -AOUTHDR aout; +struct aouthdr aout; struct external_scnhdr shdr; if (ac != 2) { diff --git a/arch/powerpc/boot/rs6000.h b/arch/powerpc/boot/rs6000.h index a9d879155ef9..584c7f9c1912 100644 --- a/arch/powerpc/boot/rs6000.h +++ b/arch/powerpc/boot/rs6000.h @@ -36,32 +36,30 @@ struct external_filehdr { /** AOUT "OPTIONAL HEADER" **/ -typedef struct -{ - unsigned charmagic[2]; /* type of file */ - unsigned charvstamp[2]; /* version stamp*/ - unsigned chartsize[4]; /* text size in bytes, padded to FW bdry */ - unsigned chardsize[4]; /* initialized data " "*/ - unsigned charbsize[4]; /* uninitialized data " " */ - unsigned charentry[4]; /* entry pt.*/ - unsigned chartext_start[4]; /* base of text used for this file */ - unsigned chardata_start[4]; /* base of data used for this file */ - unsigned charo_toc[4]; /* address of TOC */ - unsigned charo_snentry[2]; /* section number of entry point */ - unsigned charo_sntext[2];/* section number of .text section */ - unsigned charo_sndata[2];/* section number of .data section */ - unsigned charo_sntoc[2]; /* section number of TOC */ - unsigned charo_snloader[2]; /* section number of .loader section */ - unsigned charo_snbss[2]; /* section number of .bss section */ - unsigned charo_algntext[2]; /* .text alignment */ - unsigned charo_algndata[2]; /* .data alignment */ - unsigned charo_modtype[2]; /* module type (??) */ - unsigned char o_cputype[2]; /* cpu type */ - unsigned charo_maxstack[4]; /* max stack size (??) */ - unsigned char o_maxdata[4]; /* max data size (??) */ - unsigned charo_resv2[12];/* reserved */ -} -AOUTHDR; +struct aouthdr { + unsigned char magic[2]; /* type of file */ + unsigned char vstamp[2]; /* version stamp*/ + unsigned char tsize[4]; /* text size in bytes, padded to FW bdry */ + unsigned char dsize[4]; /* initialized data " "*/ + unsigned char bsize[4]; /* uninitialized data " " */ + unsigned char entry[4]; /* entry pt.*/ + unsigned char text_start[4]; /* base of text used for this file */ + unsigned char data_start[4]; /* base of data used for this file */ + unsigned char o_toc[4]; /* address of TOC */ + unsigned char o_snentry[2]; /* section number of entry point */ + unsigned char o_sntext[2];/* section number of .text section */ + unsigned char o_sndata[2];/* section number of .data section */ + unsigned char o_sntoc[2]; /* section number of TOC */ + unsigned char o_snloader[2]; /* section number of .loader section */ + unsigned char o_snbss[2]; /* section number of .bss section */ + unsigned char o_algntext[2]; /* .text alignment */ + unsigned char o_algndata[2]; /* .data alignment */ + unsigned char o_modtype[2]; /* module type (??) */ + unsigned char o_cputype[2]; /* cpu type */ + unsigned char o_maxstack[4]; /* max stack size (??) */ + unsigned char o_maxdata[4]; /* max data size (??) */ + unsigned char o_resv2[12];/* reserved */ +}; #define AOUTSZ 72 #define SMALL_AOUTSZ (28) @@ -119,10 +117,10 @@ struct external_scnhdr { */ struct external_lineno { union { - char l_symndx[4]; /* function name symbol index, iff l_lnno == 0*/ + char l_symndx[4]; /* function name symbol index, iff l_lnno == 0 */ char l_paddr[4];/* (physical) address of line number */ } l_addr; - char l_lnno[2]; /* line number */ + char l_lnno[2]; /* line number */ }; @@ -136,20 +134,19 @@ struct external_lineno { #define E_FILNMLEN 14 /* # characters in a file name */ #define E_DIMNUM 4 /* # array dimensions in auxiliary entry */ -str