Skip to contentSkip to conversation

intel_idle: Use 2-argument strscpy()

PATCH Applied Andy Shevchenko 2 participants 2 messages Aug 13 – Sep 4 Intel idle driver

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 intel_idle: Use 2-argument strscpy()

From: Andy Shevchenko <[email protected]>

Use 2-argument strscpy(), which is not only shorter but also provides an additional check that destination buffer is an array.

---
 drivers/idle/intel_idle.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/idle/intel_idle.c +2 -2
index 699665f24ecd..01a68f5b9020 100644
@@ -1904,7 +1904,7 @@ static void __init intel_idle_init_cstates_acpi_lpi(struct cpuidle_driver *drv)
 		state = &drv->states[drv->state_count++];
 
 		scnprintf(state->name, CPUIDLE_NAME_LEN, "C%d_LPI", index + 1);
-		strscpy(state->desc, lpi_state->desc, CPUIDLE_DESC_LEN);
+		strscpy(state->desc, lpi_state->desc);
 		state->exit_latency = lpi_state->wake_latency;
 		state->target_residency = lpi_state->min_residency;
 		state->flags = MWAIT2flg(lpi_state->address);
@@ -1954,7 +1954,7 @@ static void __init intel_idle_init_cstates_acpi_cst(struct cpuidle_driver *drv)
 		state = &drv->states[drv->state_count++];
 
 		snprintf(state->name, CPUIDLE_NAME_LEN, "C%d_ACPI", cstate);
-		strscpy(state->desc, cx->desc, CPUIDLE_DESC_LEN);
+		strscpy(state->desc, cx->desc);
 		state->exit_latency = cx->latency;
 		/*
 		 * For C1-type C-states use the same number for both the exit
Signature · 1 line
2.50.1
maintainer Applied
#1 lore raw
Quoted 25 lines · Andy Shevchenko

From: Andy Shevchenko <[email protected]>

Use 2-argument strscpy(), which is not only shorter but also provides an additional check that destination buffer is an array.

---
 drivers/idle/intel_idle.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/idle/intel_idle.c +1 -1
index 699665f24ecd..01a68f5b9020 100644
@@ -1904,7 +1904,7 @@ static void __init intel_idle_init_cstates_acpi_lpi(struct cpuidle_driver *drv)
                state = &drv->states[drv->state_count++];
 
                scnprintf(state->name, CPUIDLE_NAME_LEN, "C%d_LPI", index + 1);
-               strscpy(state->desc, lpi_state->desc, CPUIDLE_DESC_LEN);
+               strscpy(state->desc, lpi_state->desc);
                state->exit_latency = lpi_state->wake_latency;
                state->target_residency = lpi_state->min_residency;
                state->flags = MWAIT2flg(lpi_state->address);

drivers/idle/intel_idle.c static void __init intel_idle_init_cstates_acpi_cst(struct cpuidle_driver *drv)

Quoted 9 lines
drivers/idle/intel_idle.c +1 -2
@@ -1954,7 +1954,7 @@ static void __init intel_idle_init_cstates_acpi_cst(struct cpuidle_driver *drv)
                state = &drv->states[drv->state_count++];
 
                snprintf(state->name, CPUIDLE_NAME_LEN, "C%d_ACPI", cstate);
-               strscpy(state->desc, cx->desc, CPUIDLE_DESC_LEN);
+               strscpy(state->desc, cx->desc);
                state->exit_latency = cx->latency;
                /*
                 * For C1-type C-states use the same number for both the exit
--

Applied as 7.4 material, thanks!