]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
staging: vc04_services: changen strncpy() to strscpy_pad()
authorArnd Bergmann <arnd@arndb.de>
Wed, 13 Mar 2024 16:36:56 +0000 (17:36 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 3 Apr 2024 13:32:45 +0000 (15:32 +0200)
commit63ea4008399446aa123359f7a7693fcc213aad56
tree06a118860ba78b7265a2d8f038aa5fb153dedf3d
parentf4ff08fab66eb5c0b97e1a24edac052fb40bf5d7
staging: vc04_services: changen strncpy() to strscpy_pad()

commit ef25725b7f8aaffd7756974d3246ec44fae0a5cf upstream.

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>
drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c