]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commit
drm/msm: use strscpy instead of strncpy
authorDmitry Baryshkov <dmitry.baryshkov@linaro.org>
Wed, 18 Jan 2023 02:01:52 +0000 (04:01 +0200)
committerAndrea Righi <andrea.righi@canonical.com>
Tue, 14 Mar 2023 15:46:41 +0000 (16:46 +0100)
commit37eb0a5889a496d32bcdae5d65170e9995488b9e
tree2c8bb65e296bb1e5c6f8d393f2ba5f7df3e9ceef
parent2e6ae11de76fb81edbc99682be5d8c74eeeb1153
drm/msm: use strscpy instead of strncpy

BugLink: https://bugs.launchpad.net/bugs/2011425
[ Upstream commit d7fd8634f48d76aa799ed57beb7d87dab91bde80 ]

Using strncpy can result in non-NULL-terminated destination string. Use
strscpy instead. This fixes following warning:

drivers/gpu/drm/msm/msm_fence.c: In function ‘msm_fence_context_alloc’:
drivers/gpu/drm/msm/msm_fence.c:25:9: warning: ‘strncpy’ specified bound 32 equals destination size [-Wstringop-truncation]
   25 |         strncpy(fctx->name, name, sizeof(fctx->name));
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Fixes: f97decac5f4c ("drm/msm: Support multiple ringbuffers")
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Reviewed-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
Patchwork: https://patchwork.freedesktop.org/patch/518787/
Link: https://lore.kernel.org/r/20230118020152.1689213-1-dmitry.baryshkov@linaro.org
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
drivers/gpu/drm/msm/msm_fence.c