[PATCH] net: dsa: mt7530: refactor deprecated strncpy

Shubh shubhisroking at gmail.com
Mon Sep 4 21:16:14 PDT 2023


Prefer `strscpy_pad` to `strncpy`.

Signed-off-by: Shubh <shubhisroking at gmail.com>
---
 drivers/net/dsa/mt7530.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c
index 035a34b50..ee19475ec 100644
--- a/drivers/net/dsa/mt7530.c
+++ b/drivers/net/dsa/mt7530.c
@@ -836,7 +836,7 @@ mt7530_get_strings(struct dsa_switch *ds, int port, u32 stringset,
 		return;
 
 	for (i = 0; i < ARRAY_SIZE(mt7530_mib); i++)
-		strncpy(data + i * ETH_GSTRING_LEN, mt7530_mib[i].name,
+		strscpy_pad(data + i * ETH_GSTRING_LEN, mt7530_mib[i].name,
 			ETH_GSTRING_LEN);
 }
 
-- 
2.42.0




More information about the linux-arm-kernel mailing list