Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B1076C4332F for ; Thu, 13 Oct 2022 13:50:37 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 4AB7884F42; Thu, 13 Oct 2022 15:50:35 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=suse.de header.i=@suse.de header.b="YY6/OEAH"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="2aC3myqa"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id CB8DE84CEA; Thu, 13 Oct 2022 15:50:32 +0200 (CEST) Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 40F0A84F42 for ; Thu, 13 Oct 2022 15:50:30 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=msuchanek@suse.de Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id E6B2E22DC8; Thu, 13 Oct 2022 13:50:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1665669029; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=fpXwCvrEgE6Utcm78ZNE76usjOmlLsnQwO8i8ycvv0A=; b=YY6/OEAHomXSyBFW6qHTjQtmu3L6sMFRODVsV6DKLO6DLAZb7EDAWcNJA1PpGRVZPPZvOZ whnibBjBD85UGk7e8cs5tH5suZpyRPtbQJZUXBncHfmcveIx+kYH2owYh3yPh8SLyZJULU o/RxiWJa2Z8CCs6W6NAcA0qxFTuAAM4= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1665669029; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=fpXwCvrEgE6Utcm78ZNE76usjOmlLsnQwO8i8ycvv0A=; b=2aC3myqaBV6Ag2BZbEJlcucN6PlwrXYK1hqZEjnsIqVGKKJPsacs//mrzI6vbR9W2dIf37 WnOVC/RTr46gA2Cg== Received: from kitsune.suse.cz (kitsune.suse.cz [10.100.12.127]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 6A2092C141; Thu, 13 Oct 2022 13:50:29 +0000 (UTC) Date: Thu, 13 Oct 2022 15:50:28 +0200 From: Michal =?iso-8859-1?Q?Such=E1nek?= To: u-boot@lists.denx.de Cc: Andre Przywara , Heinrich Schuchardt , Jan Kiszka , Marek =?iso-8859-1?Q?Beh=FAn?= , Pali =?iso-8859-1?Q?Roh=E1r?= , Philippe Reynes , Sean Anderson , Simon Glass , Stefan Roese , Steven Lawrance , Rasmus Villemoes Subject: Re: [PATCH v2 1/2] image: Fix string truncation warning Message-ID: <20221013135028.GG28810@kitsune.suse.cz> References: <20221013081657.16353-1-msuchanek@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20221013081657.16353-1-msuchanek@suse.de> User-Agent: Mutt/1.10.1 (2018-07-13) X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean 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 > Signed-off-by: Michal Suchanek > --- > > 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(-) > > diff --git a/include/image.h b/include/image.h > index d7d6a3fe5b..82b447aeb7 100644 > --- a/include/image.h > +++ b/include/image.h > @@ -18,6 +18,7 @@ > #include "compiler.h" > #include > #include > +#include > > /* Define this to avoid #ifdefs later on */ > struct lmb; > @@ -275,7 +276,7 @@ struct legacy_img_hdr { > uint8_t ih_arch; /* CPU architecture */ > uint8_t ih_type; /* Image Type */ > uint8_t ih_comp; /* Compression Type */ > - uint8_t ih_name[IH_NMLEN]; /* Image Name */ > + uint8_t ih_name[IH_NMLEN] __nonstring; /* Image Name */ > }; > > struct image_info { > diff --git a/tools/kwbimage.h b/tools/kwbimage.h > index 505522332b..327ca34494 100644 > --- a/tools/kwbimage.h > +++ b/tools/kwbimage.h > @@ -11,12 +11,6 @@ > #include > #include > > -#ifdef __GNUC__ > -#define __packed __attribute((packed)) > -#else > -#define __packed > -#endif > - > #define KWBIMAGE_MAX_CONFIG ((0x1dc - 0x20)/sizeof(struct reg_config)) > #define MAX_TEMPBUF_LEN 32 > > -- > 2.37.3 >