Skip to contentSkip to conversation

cpuidle: psci: Replace deprecated strcpy in psci_idle_init_cpu

PATCH In review Thorsten Blum 4 participants 5 messages Oct 21, 2025 – Oct 28, 2025

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 cpuidle: psci: Replace deprecated strcpy in psci_idle_init_cpu

strcpy() is deprecated; use strscpy() instead.

---
 drivers/cpuidle/cpuidle-psci.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/cpuidle/cpuidle-psci.c +2 -2
index b19bc60cc627..e75d85a8f90d 100644
@@ -382,8 +382,8 @@ static int psci_idle_init_cpu(struct device *dev, int cpu)
 	drv->states[0].exit_latency = 1;
 	drv->states[0].target_residency = 1;
 	drv->states[0].power_usage = UINT_MAX;
-	strcpy(drv->states[0].name, "WFI");
-	strcpy(drv->states[0].desc, "ARM WFI");
+	strscpy(drv->states[0].name, "WFI");
+	strscpy(drv->states[0].desc, "ARM WFI");
 
 	/*
 	 * If no DT idle states are detected (ret == 0) let the driver
Signature · 1 line
2.51.0
#1 lore raw

PATCH 2/2 cpuidle: riscv-sbi: Replace deprecated strcpy in sbi_cpuidle_init_cpu

strcpy() is deprecated; use strscpy() instead.

---
 drivers/cpuidle/cpuidle-riscv-sbi.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/cpuidle/cpuidle-riscv-sbi.c +3 -2
index a360bc4d20b7..19be6475d356 100644
@@ -18,6 +18,7 @@
 #include <linux/module.h>
 #include <linux/of.h>
 #include <linux/slab.h>
+#include <linux/string.h>
 #include <linux/platform_device.h>
 #include <linux/pm_domain.h>
 #include <linux/pm_runtime.h>
@@ -303,8 +304,8 @@ static int sbi_cpuidle_init_cpu(struct device *dev, int cpu)
 	drv->states[0].exit_latency = 1;
 	drv->states[0].target_residency = 1;
 	drv->states[0].power_usage = UINT_MAX;
-	strcpy(drv->states[0].name, "WFI");
-	strcpy(drv->states[0].desc, "RISC-V WFI");
+	strscpy(drv->states[0].name, "WFI");
+	strscpy(drv->states[0].desc, "RISC-V WFI");
 
 	/*
 	 * If no DT idle states are detected (ret == 0) let the driver
Signature · 1 line
2.51.0
#4 lore raw
In reply to Thorsten Blum
Quoted 5 lines · Thorsten Blum

strcpy() is deprecated; use strscpy() instead.

Applied for next, thanks!

Kind regards
Uffe

Quoted 22 lines
---
 drivers/cpuidle/cpuidle-psci.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/cpuidle/cpuidle-psci.c +2 -3
index b19bc60cc627..e75d85a8f90d 100644
@@ -382,8 +382,8 @@ static int psci_idle_init_cpu(struct device *dev, int cpu)
        drv->states[0].exit_latency = 1;
        drv->states[0].target_residency = 1;
        drv->states[0].power_usage = UINT_MAX;
-       strcpy(drv->states[0].name, "WFI");
-       strcpy(drv->states[0].desc, "ARM WFI");
+       strscpy(drv->states[0].name, "WFI");
+       strscpy(drv->states[0].desc, "ARM WFI");
 
        /*
         * If no DT idle states are detected (ret == 0) let the driver
--

2.51.0

maintainer Reviewed-by on v1 2/2
#3 lore raw

Re: [PATCH 2/2] cpuidle: riscv-sbi: Replace deprecated strcpy in sbi_cpuidle_init_cpu

In reply to Thorsten Blum
Quoted 5 lines · Thorsten Blum

strcpy() is deprecated; use strscpy() instead.

LGTM.

Regards,
Anup

Quoted 30 lines
---
 drivers/cpuidle/cpuidle-riscv-sbi.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/cpuidle/cpuidle-riscv-sbi.c +3 -3
index a360bc4d20b7..19be6475d356 100644
@@ -18,6 +18,7 @@
 #include <linux/module.h>
 #include <linux/of.h>
 #include <linux/slab.h>
+#include <linux/string.h>
 #include <linux/platform_device.h>
 #include <linux/pm_domain.h>
 #include <linux/pm_runtime.h>
@@ -303,8 +304,8 @@ static int sbi_cpuidle_init_cpu(struct device *dev, int cpu)
        drv->states[0].exit_latency = 1;
        drv->states[0].target_residency = 1;
        drv->states[0].power_usage = UINT_MAX;
-       strcpy(drv->states[0].name, "WFI");
-       strcpy(drv->states[0].desc, "RISC-V WFI");
+       strscpy(drv->states[0].name, "WFI");
+       strscpy(drv->states[0].desc, "RISC-V WFI");
 
        /*
         * If no DT idle states are detected (ret == 0) let the driver
--

2.51.0