Skip to contentSkip to conversation

x86/hpet: use strscpy() is more robust and safer

PATCH New [email protected] 1 participant 1 message Sep 16, 2022

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

PATCH 1/1 x86/hpet: use strscpy() is more robust and safer

From: Minghao Chi <[email protected]>

The implementation of strscpy() is more robust and safer.

That's now the recommended way to copy NUL terminated strings.

---
 arch/x86/kernel/hpet.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kernel/hpet.c +1 -1
index 71f336425e58..47ef8aecdd37 100644
@@ -421,7 +421,7 @@ static void __init hpet_legacy_clockevent_register(struct hpet_channel *hc)
 	 * the IO_APIC has been initialized.
 	 */
 	hc->cpu = boot_cpu_data.cpu_index;
-	strncpy(hc->name, "hpet", sizeof(hc->name));
+	strscpy(hc->name, "hpet", sizeof(hc->name));
 	hpet_init_clockevent(hc, 50);
 
 	hc->evt.tick_resume	= hpet_clkevt_legacy_resume;
Signature · 1 line
2.25.1