Skip to content

Commit f4a0659

Browse files
azeemshaikh38kees
authored andcommitted
drm/i2c: tda998x: Replace all non-returning strlcpy with strscpy
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 [1]. In an effort to remove strlcpy() completely [2], replace strlcpy() here with strscpy(). No return values were used, so direct replacement is safe. [1] https://www.kernel.org/doc/html/latest/process/deprecated.html#strlcpy [2] KSPP#89 Signed-off-by: Azeem Shaikh <[email protected]> Reviewed-by: Kees Cook <[email protected]> Signed-off-by: Kees Cook <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 8360257 commit f4a0659

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/gpu/drm/i2c/tda998x_drv.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1951,7 +1951,7 @@ static int tda998x_create(struct device *dev)
19511951
* offset.
19521952
*/
19531953
memset(&cec_info, 0, sizeof(cec_info));
1954-
strlcpy(cec_info.type, "tda9950", sizeof(cec_info.type));
1954+
strscpy(cec_info.type, "tda9950", sizeof(cec_info.type));
19551955
cec_info.addr = priv->cec_addr;
19561956
cec_info.platform_data = &priv->cec_glue;
19571957
cec_info.irq = client->irq;

0 commit comments

Comments
 (0)