Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

i2c: move core from strlcpy to strscpy

Follow the advice of the below link and prefer 'strscpy'. Conversion is
easy because no code used the return value. It has been done with a
simple sed invocation.

Link: https://lore.kernel.org/r/CAHk-=wgfRnXz0W3D37d01q3JFkr_i_uTL=V6A6G1oUZcprmknw@mail.gmail.com/
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Wolfram Sang <wsa@kernel.org>

authored by

Wolfram Sang and committed by
Wolfram Sang
0b0221d9 ea1558ce

+2 -2
+1 -1
drivers/i2c/i2c-core-base.c
··· 933 933 client->init_irq = i2c_dev_irq_from_resources(info->resources, 934 934 info->num_resources); 935 935 936 - strlcpy(client->name, info->type, sizeof(client->name)); 936 + strscpy(client->name, info->type, sizeof(client->name)); 937 937 938 938 status = i2c_check_addr_validity(client->addr, client->flags); 939 939 if (status) {
+1 -1
drivers/i2c/i2c-smbus.c
··· 391 391 unsigned short addr_list[2]; 392 392 393 393 memset(&info, 0, sizeof(struct i2c_board_info)); 394 - strlcpy(info.type, name, I2C_NAME_SIZE); 394 + strscpy(info.type, name, I2C_NAME_SIZE); 395 395 addr_list[0] = 0x50 + n; 396 396 addr_list[1] = I2C_CLIENT_END; 397 397