Skip to contentSkip to conversation

mfd: move from strlcpy with unused retval to strscpy

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

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

PATCH 1/1 mfd: 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/mfd/htc-i2cpld.c | 2 +-
 drivers/mfd/lpc_ich.c    | 2 +-
 drivers/mfd/mfd-core.c   | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
drivers/mfd/htc-i2cpld.c +1 -1
index 417b0355d904..9232b4ba034d 100644
@@ -352,7 +352,7 @@ static int htcpld_register_chip_i2c(
 
 	memset(&info, 0, sizeof(struct i2c_board_info));
 	info.addr = plat_chip_data->addr;
-	strlcpy(info.type, "htcpld-chip", I2C_NAME_SIZE);
+	strscpy(info.type, "htcpld-chip", I2C_NAME_SIZE);
 	info.platform_data = chip;
 
 	/* Add the I2C device.  This calls the probe() function. */
drivers/mfd/lpc_ich.c +1 -1
index 650951f89f1c..7b1c597b6879 100644
@@ -959,7 +959,7 @@ static int lpc_ich_finalize_wdt_cell(struct pci_dev *dev)
 	info = &lpc_chipset_info[priv->chipset];
 
 	pdata->version = info->iTCO_version;
-	strlcpy(pdata->name, info->name, sizeof(pdata->name));
+	strscpy(pdata->name, info->name, sizeof(pdata->name));
 
 	cell->platform_data = pdata;
 	cell->pdata_size = sizeof(*pdata);
drivers/mfd/mfd-core.c +1 -1
index 8b058200d5ad..a4479c1fc5a7 100644
@@ -105,7 +105,7 @@ static void mfd_acpi_add_device(const struct mfd_cell *cell,
 				.ids = ids,
 			};
 
-			strlcpy(ids[0].id, match->pnpid, sizeof(ids[0].id));
+			strscpy(ids[0].id, match->pnpid, sizeof(ids[0].id));
 			acpi_dev_for_each_child(parent, match_device_ids, &wd);
 			adev = wd.adev;
 		} else {
Signature · 1 line
2.35.1
maintainer Applied
#1 lore raw
Quoted 11 lines · Wolfram Sang

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/mfd/htc-i2cpld.c | 2 +-
 drivers/mfd/lpc_ich.c    | 2 +-
 drivers/mfd/mfd-core.c   | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

Applied, thanks.

Signature · 1 line
Lee Jones [李琼斯]