Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit ef25725

Browse files
arndbgregkh
authored andcommitted
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>
1 parent 4cece76 commit ef25725

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -937,8 +937,8 @@ static int create_component(struct vchiq_mmal_instance *instance,
937937
/* build component create message */
938938
m.h.type = MMAL_MSG_TYPE_COMPONENT_CREATE;
939939
m.u.component_create.client_component = component->client_component;
940-
strncpy(m.u.component_create.name, name,
941-
sizeof(m.u.component_create.name));
940+
strscpy_pad(m.u.component_create.name, name,
941+
sizeof(m.u.component_create.name));
942942

943943
ret = send_synchronous_mmal_msg(instance, &m,
944944
sizeof(m.u.component_create),

0 commit comments

Comments
 (0)