Skip to content

Commit

Permalink
i2c: move core from strlcpy to strscpy
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Wolfram Sang authored and Wolfram Sang committed Aug 11, 2022
1 parent ea1558c commit 0b0221d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion drivers/i2c/i2c-core-base.c
Original file line number Diff line number Diff line change
Expand Up @@ -933,7 +933,7 @@ i2c_new_client_device(struct i2c_adapter *adap, struct i2c_board_info const *inf
client->init_irq = i2c_dev_irq_from_resources(info->resources,
info->num_resources);

strlcpy(client->name, info->type, sizeof(client->name));
strscpy(client->name, info->type, sizeof(client->name));

status = i2c_check_addr_validity(client->addr, client->flags);
if (status) {
Expand Down
2 changes: 1 addition & 1 deletion drivers/i2c/i2c-smbus.c
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ void i2c_register_spd(struct i2c_adapter *adap)
unsigned short addr_list[2];

memset(&info, 0, sizeof(struct i2c_board_info));
strlcpy(info.type, name, I2C_NAME_SIZE);
strscpy(info.type, name, I2C_NAME_SIZE);
addr_list[0] = 0x50 + n;
addr_list[1] = I2C_CLIENT_END;

Expand Down

0 comments on commit 0b0221d

Please sign in to comment.