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 D9F54C4332F for ; Thu, 13 Oct 2022 08:17:27 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 373F784F14; Thu, 13 Oct 2022 10:17:15 +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="dVuk1z51"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="rlKZ1z51"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id E334384928; Thu, 13 Oct 2022 10:17:07 +0200 (CEST) Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) (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 0520284E91 for ; Thu, 13 Oct 2022 10:17:04 +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-out2.suse.de (Postfix) with ESMTP id CAB131F38A; Thu, 13 Oct 2022 08:17:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1665649023; 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; bh=Hv5yiCca+bm2ZpbUsGuJNG3RWT5vQKUd7Jh8dTC9xEs=; b=dVuk1z51qfHF76ouYIC3ndZ/o3BtaSU4dT707I7Rjc4Ypn2TSi6WksFT2eLXeBt50rpaEG DMWBGpqAKlRrzfDLkwKYqoJXitdsHnMP5BV3BuQwducRWnXK6z7t7x1JdcUXbvZPVmNUAW 6peU8XX85DAlCyZimr95W41WqlvvGPs= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1665649023; 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; bh=Hv5yiCca+bm2ZpbUsGuJNG3RWT5vQKUd7Jh8dTC9xEs=; b=rlKZ1z51MRvxEx5MeS4gH4AwgRoWBF0TFO7IlRPuYBCBUa4M6sOt8JAul83cOnY39hUxw5 cT+VJUOwAwqf/YDA== Received: from naga.suse.cz (unknown [10.100.224.114]) by relay2.suse.de (Postfix) with ESMTP id 7B5282C142; Thu, 13 Oct 2022 08:17:03 +0000 (UTC) From: Michal Suchanek To: u-boot@lists.denx.de Cc: Michal Suchanek , Andre Przywara , Heinrich Schuchardt , Jan Kiszka , =?UTF-8?q?Marek=20Beh=C3=BAn?= , =?UTF-8?q?Pali=20Roh=C3=A1r?= , Philippe Reynes , Sean Anderson , Simon Glass , Stefan Roese , Steven Lawrance Subject: [PATCH v2 1/2] image: Fix string truncation warning Date: Thu, 13 Oct 2022 10:16:56 +0200 Message-Id: <20221013081657.16353-1-msuchanek@suse.de> X-Mailer: git-send-email 2.37.3 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 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 --- 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