summaryrefslogtreecommitdiff
path: root/drivers/staging
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2024-03-13 19:36:56 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-03-25 21:09:52 +0300
commitef25725b7f8aaffd7756974d3246ec44fae0a5cf (patch)
tree0934cf351945ea2c0dd9d1068b0e1aa817bd4f2a /drivers/staging
parent4cece764965020c22cff7665b18a012006359095 (diff)
downloadlinux-ef25725b7f8aaffd7756974d3246ec44fae0a5cf.tar.xz
staging: vc04_services: changen strncpy() to strscpy_pad()
gcc-14 warns about this strncpy() that results in a non-terminated string for an overflow: In file included from include/linux/string.h:369, from drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c:20: In function 'strncpy', inlined from 'create_component' at drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c:940:2: include/linux/fortify-string.h:108:33: error: '__builtin_strncpy' specified bound 128 equals destination size [-Werror=stringop-truncation] Change it to strscpy_pad(), which produces a properly terminated and zero-padded string. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org> Link: https://lore.kernel.org/r/20240313163712.224585-1-arnd@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging')
-rw-r--r--drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c
index 258aa0e37f55..6ca5797aeae5 100644
--- a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c
+++ b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c
@@ -937,8 +937,8 @@ static int create_component(struct vchiq_mmal_instance *instance,
/* build component create message */
m.h.type = MMAL_MSG_TYPE_COMPONENT_CREATE;
m.u.component_create.client_component = component->client_component;
- strncpy(m.u.component_create.name, name,
- sizeof(m.u.component_create.name));
+ strscpy_pad(m.u.component_create.name, name,
+ sizeof(m.u.component_create.name));
ret = send_synchronous_mmal_msg(instance, &m,
sizeof(m.u.component_create),