summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/drm_mipi_dsi.c
diff options
context:
space:
mode:
authorAzeem Shaikh <azeemshaikh38@gmail.com>2023-05-22 15:51:24 +0000
committerKees Cook <keescook@chromium.org>2023-06-01 07:07:36 -0700
commit533950d32d292cc4d0cef5b85af57948b8dcb11a (patch)
tree6cb914f8d5fb2f857d0744888548511de2dd29be /drivers/gpu/drm/drm_mipi_dsi.c
parent26f15e5de15f7917358af0fda4291b74a3285989 (diff)
downloadlinux-stable-533950d32d292cc4d0cef5b85af57948b8dcb11a.tar.gz
linux-stable-533950d32d292cc4d0cef5b85af57948b8dcb11a.tar.bz2
linux-stable-533950d32d292cc4d0cef5b85af57948b8dcb11a.zip
drm/display/dp_mst: 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] https://github.com/KSPP/linux/issues/89 Signed-off-by: Azeem Shaikh <azeemshaikh38@gmail.com> Reviewed-by: Kees Cook <keescook@chromium.org> Signed-off-by: Kees Cook <keescook@chromium.org> Link: https://lore.kernel.org/r/20230522155124.2336545-1-azeemshaikh38@gmail.com
Diffstat (limited to 'drivers/gpu/drm/drm_mipi_dsi.c')
-rw-r--r--drivers/gpu/drm/drm_mipi_dsi.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/gpu/drm/drm_mipi_dsi.c b/drivers/gpu/drm/drm_mipi_dsi.c
index 3fd6c733ff4e..6252ac01e945 100644
--- a/drivers/gpu/drm/drm_mipi_dsi.c
+++ b/drivers/gpu/drm/drm_mipi_dsi.c
@@ -223,7 +223,7 @@ mipi_dsi_device_register_full(struct mipi_dsi_host *host,
device_set_node(&dsi->dev, of_fwnode_handle(info->node));
dsi->channel = info->channel;
- strlcpy(dsi->name, info->type, sizeof(dsi->name));
+ strscpy(dsi->name, info->type, sizeof(dsi->name));
ret = mipi_dsi_device_add(dsi);
if (ret) {