On Thu, Oct 13, 2022 at 09:29:22AM +0200, Rasmus Villemoes wrote: > On 12/10/2022 21.47, Michal Suchanek wrote: > > In file included from ../tools/imagetool.h:24, > > from ../tools/default_image.c:16: > > In function ‘image_set_name’, > > inlined from ‘image_set_header’ at ../tools/default_image.c:133:2: > > ../include/image.h:786:9: warning: ‘strncpy’ specified bound 32 equals > > destination size [-Wstringop-truncation] > > 786 | strncpy(image_get_name(hdr), name, IH_NMLEN); > > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > > > There is no standard function that can be used to make the copy without > > a warning. > > True, but the compiler does give a way to inform that the destination is > not _supposed_ to be a nul-terminated string. > > https://lore.kernel.org/u-boot/[email protected]/ > > And our include/linux/compiler_attributes.h indeed already exposes that > __nonstring attribute. Perhaps try applying that to the ih_name member.
That's better, that's an actual fix. Thanks Michal

