Skip to contentSkip to conversation

cpufreq: Replace deprecated strcpy in cpufreq_unregister_governor

PATCH In review Thorsten Blum 2 participants 2 messages Oct 17, 2025 – Oct 22, 2025 CPU frequency scaling framework

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cpufreq: Replace deprecated strcpy in cpufreq_unregister_governor

strcpy() is deprecated; assign the NUL terminator directly instead.

---
 drivers/cpufreq/cpufreq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/cpufreq/cpufreq.c +1 -1
index 852e024facc3..0d3e77cf96a7 100644
@@ -2550,7 +2550,7 @@ void cpufreq_unregister_governor(struct cpufreq_governor *governor)
 	for_each_inactive_policy(policy) {
 		if (!strcmp(policy->last_governor, governor->name)) {
 			policy->governor = NULL;
-			strcpy(policy->last_governor, "\0");
+			policy->last_governor[0] = '\0';
 		}
 	}
 	read_unlock_irqrestore(&cpufreq_driver_lock, flags);
Signature · 1 line
2.51.0
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 13 lines · Thorsten Blum

strcpy() is deprecated; assign the NUL terminator directly instead.

---
 drivers/cpufreq/cpufreq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/cpufreq/cpufreq.c +0 -0
index 852e024facc3..0d3e77cf96a7 100644

drivers/cpufreq/cpufreq.c void cpufreq_unregister_governor(struct cpufreq_governor *governor) · line 2556

Quoted 8 lines
drivers/cpufreq/cpufreq.c +1 -1
@@ -2550,7 +2550,7 @@ void cpufreq_unregister_governor(struct cpufreq_governor *governor)
 	for_each_inactive_policy(policy) {
 		if (!strcmp(policy->last_governor, governor->name)) {
 			policy->governor = NULL;
-			strcpy(policy->last_governor, "\0");
+			policy->last_governor[0] = '\0';
 		}
 	}
 	read_unlock_irqrestore(&cpufreq_driver_lock, flags);
Signature · 1 line
viresh