Skip to content

Commit 2456854

Browse files
ruscurmpe
authored andcommitted
powerpc/pasemi: Use strscpy instead of strlcpy
find_i2c_driver() contained the last usage of strlcpy() in arch/powerpc. The return value was used to check if strlen(src) >= n, for which strscpy() returns -E2BIG. Signed-off-by: Russell Currey <[email protected]> Signed-off-by: Michael Ellerman <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 9b135ee commit 2456854

File tree

1 file changed

+1
-2
lines changed
  • arch/powerpc/platforms/pasemi

1 file changed

+1
-2
lines changed

arch/powerpc/platforms/pasemi/misc.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@ static int __init find_i2c_driver(struct device_node *node,
3636
for (i = 0; i < ARRAY_SIZE(i2c_devices); i++) {
3737
if (!of_device_is_compatible(node, i2c_devices[i].of_device))
3838
continue;
39-
if (strlcpy(info->type, i2c_devices[i].i2c_type,
40-
I2C_NAME_SIZE) >= I2C_NAME_SIZE)
39+
if (strscpy(info->type, i2c_devices[i].i2c_type, I2C_NAME_SIZE) < 0)
4140
return -ENOMEM;
4241
return 0;
4342
}

0 commit comments

Comments
 (0)