aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/lima/lima_sched.c
diff options
context:
space:
mode:
authorLuo Jiaxing <[email protected]>2021-03-08 08:32:52 +0000
committerKarol Herbst <[email protected]>2021-11-12 22:46:04 +0000
commit22da19f900be6b90b6984522708b203ac9bce1e6 (patch)
tree42d4be741fe238ea874d7d4370d7694d2c033d92 /drivers/gpu/drm/lima/lima_sched.c
parentdrm/nouveau/kms/nv04: use vzalloc for nv04_display (diff)
downloadkernel-22da19f900be6b90b6984522708b203ac9bce1e6.tar.gz
kernel-22da19f900be6b90b6984522708b203ac9bce1e6.zip
drm/nouveau/device: use snprintf() to replace strncpy() to avoid NUL-terminated string loss
Following warning is found when using W=1 to build kernel: In function ‘nvkm_udevice_info’, inlined from ‘nvkm_udevice_mthd’ at drivers/gpu/drm/nouveau/nvkm/engine/device/user.c:195:10: drivers/gpu/drm/nouveau/nvkm/engine/device/user.c:164:2: warning: ‘strncpy’ specified bound 16 equals destination size [-Wstringop-truncation] 164 | strncpy(args->v0.chip, device->chip->name, sizeof(args->v0.chip)); drivers/gpu/drm/nouveau/nvkm/engine/device/user.c:165:2: warning: ‘strncpy’ specified bound 64 equals destination size [-Wstringop-truncation] 165 | strncpy(args->v0.name, device->name, sizeof(args->v0.name)); The reason of this warning is strncpy() does not guarantee that the destination buffer will be NUL terminated. If the length of source string is bigger than number we set by third input parameter, only a part of characters is copied to the destination, and no NUL-terminated string is automatically added. There are some potential risks. So use snprintf() to replace strncpy(). Signed-off-by: Luo Jiaxing <[email protected]> Signed-off-by: Ben Skeggs <[email protected]> Reviewed-by: Karol Herbst <[email protected]> Signed-off-by: Karol Herbst <[email protected]> Link: https://gitlab.freedesktop.org/drm/nouveau/-/merge_requests/10
Diffstat (limited to 'drivers/gpu/drm/lima/lima_sched.c')
0 files changed, 0 insertions, 0 deletions