[PATCH] clk: zynqmp: fix -Wstringop-truncation warnings

Li Wang li.wang at windriver.com
Thu Dec 17 01:26:22 EST 2020


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

Signed-off-by: Li Wang <li.wang at windriver.com>
---
 drivers/clk/zynqmp/clkc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clk/zynqmp/clkc.c b/drivers/clk/zynqmp/clkc.c
index db8d0d7..58a2c6e 100644
--- a/drivers/clk/zynqmp/clkc.c
+++ b/drivers/clk/zynqmp/clkc.c
@@ -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;
 	}
 
-- 
2.7.4




More information about the linux-arm-kernel mailing list