aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorThorsten Blum <thorsten.blum@linux.dev>2025-04-16 21:09:07 +0200
committerDinh Nguyen <dinguyen@kernel.org>2025-04-24 17:30:01 -0500
commitaa264d9511aa5befa28cf8d9f32fce78fcf1a773 (patch)
tree43f0f22676c6e18d008902fd6739fbd69960b9d9
parentnios2: do not introduce conflicting mappings when flushing tlb entries (diff)
downloadwireguard-linux-aa264d9511aa5befa28cf8d9f32fce78fcf1a773.tar.xz
wireguard-linux-aa264d9511aa5befa28cf8d9f32fce78fcf1a773.zip
nios2: Replace strcpy() with strscpy() and simplify setup_cpuinfo()
strcpy() is deprecated; use strscpy() instead. Since the destination buffer has a fixed length, strscpy() automatically determines its size using sizeof() when the size argument is omitted. This makes the explicit size argument unnecessary - remove it. Now, combine both if-else branches using strscpy() and the same buffer into a single statement to simplify the code. No functional changes intended. Link: https://github.com/KSPP/linux/issues/88 Cc: linux-hardening@vger.kernel.org Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev> Reviewed-by: Kees Cook <kees@kernel.org> Signed-off-by: Dinh Nguyen <dinguyen@kernel.org>
-rw-r--r--arch/nios2/kernel/cpuinfo.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/arch/nios2/kernel/cpuinfo.c b/arch/nios2/kernel/cpuinfo.c
index 7b1e8f9128e9..55882feb6249 100644
--- a/arch/nios2/kernel/cpuinfo.c
+++ b/arch/nios2/kernel/cpuinfo.c
@@ -46,10 +46,7 @@ void __init setup_cpuinfo(void)
cpuinfo.cpu_clock_freq = fcpu(cpu, "clock-frequency");
str = of_get_property(cpu, "altr,implementation", &len);
- if (str)
- strscpy(cpuinfo.cpu_impl, str, sizeof(cpuinfo.cpu_impl));
- else
- strcpy(cpuinfo.cpu_impl, "<unknown>");
+ strscpy(cpuinfo.cpu_impl, str ?: "<unknown>");
cpuinfo.has_div = of_property_read_bool(cpu, "altr,has-div");
cpuinfo.has_mul = of_property_read_bool(cpu, "altr,has-mul");