aboutsummaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorRussell Currey2022-08-27 16:39:46 +1000
committerMichael Ellerman2022-09-06 11:03:04 +1000
commit245685495bff35062a394f5cdbd32b237dc596a5 (patch)
tree4f0c2d3375bcdcecc03ad7d3e80fa53cdc6dda33 /arch
parent9b135eef0787813ad073aaeb9ff80ab57bc63e69 (diff)
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 <ruscur@russell.cc> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://lore.kernel.org/r/20220827063946.9073-1-ruscur@russell.cc
Diffstat (limited to 'arch')
-rw-r--r--arch/powerpc/platforms/pasemi/misc.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/arch/powerpc/platforms/pasemi/misc.c b/arch/powerpc/platforms/pasemi/misc.c
index f859ada29074..9e9a7e46288a 100644
--- a/arch/powerpc/platforms/pasemi/misc.c
+++ b/arch/powerpc/platforms/pasemi/misc.c
@@ -36,8 +36,7 @@ static int __init find_i2c_driver(struct device_node *node,
for (i = 0; i < ARRAY_SIZE(i2c_devices); i++) {
if (!of_device_is_compatible(node, i2c_devices[i].of_device))
continue;
- if (strlcpy(info->type, i2c_devices[i].i2c_type,
- I2C_NAME_SIZE) >= I2C_NAME_SIZE)
+ if (strscpy(info->type, i2c_devices[i].i2c_type, I2C_NAME_SIZE) < 0)
return -ENOMEM;
return 0;
}