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

Simon Glass sjg at chromium.org
Fri Oct 14 17:55:49 CEST 2022


Hi,

On Thu, 13 Oct 2022 at 07:50, Michal Suchánek <msuchanek at suse.de> wrote:
>
> 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);
> >       |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> Suggested-by: Rasmus Villemoes <rasmus.villemoes at prevas.dk>
> > Signed-off-by: Michal Suchanek <msuchanek at suse.de>
> > ---
> >
> > Changes in v2:
> > Use __nonstring instead of suppressing the warning
> >
> > ---
> >  include/image.h  | 3 ++-
> >  tools/kwbimage.h | 6 ------
> >  2 files changed, 2 insertions(+), 7 deletions(-)

+Tom Rini you can drop my one then:

https://patchwork.ozlabs.org/project/uboot/patch/20221013122927.636867-30-sjg@chromium.org/

Reviewed-by: Simon Glass <sjg at chromium.org>


More information about the U-Boot mailing list