[PATCH v2 1/2] image: Fix string truncation warning

Tom Rini trini at konsulko.com
Sat Oct 22 00:37:51 CEST 2022


On Thu, Oct 13, 2022 at 10:16:56AM +0200, 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);
>       |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 
> Signed-off-by: Michal Suchanek <msuchanek at suse.de>
> Reviewed-by: Simon Glass <sjg at chromium.org>
> ---
> 
> Changes in v2:
> Use __nonstring instead of suppressing the warning

This breaks a ton of boards such as crs305-1g-4s in tools/kwbimage.h.

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20221021/ab36a5eb/attachment.sig>


More information about the U-Boot mailing list