Skip to contentSkip to conversation

clk: move from strlcpy with unused retval to strscpy

PATCH Applied Wolfram Sang 2 participants 2 messages Aug 18, 2022 – Aug 22, 2022

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

PATCH 1/1 clk: move from strlcpy with unused retval to strscpy

Follow the advice of the below link and prefer 'strscpy' in this subsystem. Conversion is 1:1 because the return value is not used. Generated by a coccinelle script.

---
 drivers/clk/clkdev.c             | 2 +-
 drivers/clk/mvebu/dove-divider.c | 2 +-
 drivers/clk/tegra/clk-bpmp.c     | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
drivers/clk/clkdev.c +1 -1
index 67f601a41023..a4d4bd3f5be5 100644
@@ -165,7 +165,7 @@ vclkdev_alloc(struct clk_hw *hw, const char *con_id, const char *dev_fmt,
 
 	cla->cl.clk_hw = hw;
 	if (con_id) {
-		strlcpy(cla->con_id, con_id, sizeof(cla->con_id));
+		strscpy(cla->con_id, con_id, sizeof(cla->con_id));
 		cla->cl.con_id = cla->con_id;
 	}
 
drivers/clk/mvebu/dove-divider.c +1 -1
index 7e35c891e168..0a90452ee808 100644
@@ -170,7 +170,7 @@ static struct clk *clk_register_dove_divider(struct device *dev,
 		.num_parents = num_parents,
 	};
 
-	strlcpy(name, dc->name, sizeof(name));
+	strscpy(name, dc->name, sizeof(name));
 
 	dc->hw.init = &init;
 	dc->base = base;
drivers/clk/tegra/clk-bpmp.c +1 -1
index 3748a39dae7c..d82a71f10c2c 100644
@@ -349,7 +349,7 @@ static int tegra_bpmp_clk_get_info(struct tegra_bpmp *bpmp, unsigned int id,
 	if (err < 0)
 		return err;
 
-	strlcpy(info->name, response.name, MRQ_CLK_NAME_MAXLEN);
+	strscpy(info->name, response.name, MRQ_CLK_NAME_MAXLEN);
 	info->num_parents = response.num_parents;
 
 	for (i = 0; i < info->num_parents; i++)
Signature · 1 line
2.35.1