Skip to content

Commit 576f0d7

Browse files
azeemshaikh38kees
authored andcommitted
drm/rockchip: 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 533950d commit 576f0d7

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

drivers/gpu/drm/rockchip/inno_hdmi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -797,7 +797,7 @@ static struct i2c_adapter *inno_hdmi_i2c_adapter(struct inno_hdmi *hdmi)
797797
adap->dev.parent = hdmi->dev;
798798
adap->dev.of_node = hdmi->dev->of_node;
799799
adap->algo = &inno_hdmi_algorithm;
800-
strlcpy(adap->name, "Inno HDMI", sizeof(adap->name));
800+
strscpy(adap->name, "Inno HDMI", sizeof(adap->name));
801801
i2c_set_adapdata(adap, hdmi);
802802

803803
ret = i2c_add_adapter(adap);

drivers/gpu/drm/rockchip/rk3066_hdmi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -730,7 +730,7 @@ static struct i2c_adapter *rk3066_hdmi_i2c_adapter(struct rk3066_hdmi *hdmi)
730730
adap->dev.parent = hdmi->dev;
731731
adap->dev.of_node = hdmi->dev->of_node;
732732
adap->algo = &rk3066_hdmi_algorithm;
733-
strlcpy(adap->name, "RK3066 HDMI", sizeof(adap->name));
733+
strscpy(adap->name, "RK3066 HDMI", sizeof(adap->name));
734734
i2c_set_adapdata(adap, hdmi);
735735

736736
ret = i2c_add_adapter(adap);

0 commit comments

Comments
 (0)