Skip to content

Commit e47a0ce

Browse files
Len Bakerwsakernel
authored andcommitted
i2c: sun6i-pw2i: Prefer strscpy over strlcpy
strlcpy() reads the entire source buffer first. This read may exceed the destination size limit. This is both inefficient and can lead to linear read overflows if a source string is not NUL-terminated. The safe replacement is strscpy(). This is a previous step in the path to remove the strlcpy() function entirely from the kernel [1]. [1] KSPP/linux#89 Signed-off-by: Len Baker <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
1 parent e517992 commit e47a0ce

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/i2c/busses/i2c-sun6i-p2wi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ static int p2wi_probe(struct platform_device *pdev)
234234
if (IS_ERR(p2wi->regs))
235235
return PTR_ERR(p2wi->regs);
236236

237-
strlcpy(p2wi->adapter.name, pdev->name, sizeof(p2wi->adapter.name));
237+
strscpy(p2wi->adapter.name, pdev->name, sizeof(p2wi->adapter.name));
238238
irq = platform_get_irq(pdev, 0);
239239
if (irq < 0)
240240
return irq;

0 commit comments

Comments
 (0)