Skip to contentSkip to conversation

clk: zynqmp: fix -Wstringop-truncation warnings

PATCH New Li Wang 1 participant 1 message Dec 17, 2020

Subsystems (2)
lore
Share & tools
lore

Li Wang

author
#0 lore raw

PATCH 1/1 clk: zynqmp: fix -Wstringop-truncation warnings

Replace strncpy() with strscpy(), fixes the following warning:
warning: 'strncpy' specified bound 50 equals destination size [-Wstringop-truncation]

---
 drivers/clk/zynqmp/clkc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/zynqmp/clkc.c +1 -1
index db8d0d7..58a2c6e 100644
@@ -163,7 +163,7 @@ static int zynqmp_get_clock_name(u32 clk_id, char *clk_name)
 
 	ret = zynqmp_is_valid_clock(clk_id);
 	if (ret == 1) {
-		strncpy(clk_name, clock[clk_id].clk_name, MAX_NAME_LEN);
+		strscpy(clk_name, clock[clk_id].clk_name, MAX_NAME_LEN);
 		return 0;
 	}
 
Signature · 7 lines
2.7.4


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel