|
|
8bc6b11 |
From: Thomas Huth <thuth@redhat.com>
|
|
|
8bc6b11 |
Date: Thu, 19 Jul 2018 14:46:25 +0200
|
|
|
8bc6b11 |
Subject: [PATCH] romfs/tools: Silence GCC 8.1 compiler warning with
|
|
|
8bc6b11 |
FLASHFS_MAGIC
|
|
|
8bc6b11 |
MIME-Version: 1.0
|
|
|
8bc6b11 |
Content-Type: text/plain; charset=UTF-8
|
|
|
8bc6b11 |
Content-Transfer-Encoding: 8bit
|
|
|
8bc6b11 |
|
|
|
8bc6b11 |
GCC 8.1 introduce some new warnings which affect create_crc.c. One of
|
|
|
8bc6b11 |
them is:
|
|
|
8bc6b11 |
|
|
|
8bc6b11 |
create_crc.c: In function ‘createHeaderImage’:
|
|
|
8bc6b11 |
create_crc.c:110:2: warning: ‘strncpy’ output truncated before terminating nul
|
|
|
8bc6b11 |
copying 8 bytes from a string of the same length [-Wstringop-truncation]
|
|
|
8bc6b11 |
strncpy(uHeader.stHeader.magic, FLASHFS_MAGIC, 8);
|
|
|
8bc6b11 |
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
8bc6b11 |
|
|
|
8bc6b11 |
Initialize the header struct statically here instead to silence the warning.
|
|
|
8bc6b11 |
|
|
|
8bc6b11 |
Suggested-by: Segher Boessenkool <segher@kernel.crashing.org>
|
|
|
8bc6b11 |
Signed-off-by: Thomas Huth <thuth@redhat.com>
|
|
|
8bc6b11 |
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
|
|
|
8bc6b11 |
(cherry picked from commit 49482e06ea74652a70a8cd067b852cc142021c03)
|
|
|
8bc6b11 |
---
|
|
|
8bc6b11 |
romfs/tools/create_crc.c | 21 ++++++---------------
|
|
|
8bc6b11 |
1 file changed, 6 insertions(+), 15 deletions(-)
|
|
|
8bc6b11 |
|
|
|
8bc6b11 |
diff --git a/romfs/tools/create_crc.c b/romfs/tools/create_crc.c
|
|
|
8bc6b11 |
index e354339..475b184 100644
|
|
|
8bc6b11 |
--- a/romfs/tools/create_crc.c
|
|
|
8bc6b11 |
+++ b/romfs/tools/create_crc.c
|
|
|
8bc6b11 |
@@ -72,10 +72,12 @@ createHeaderImage(int notime)
|
|
|
8bc6b11 |
char dastr[16] = { 0, };
|
|
|
8bc6b11 |
unsigned long long da = 0;
|
|
|
8bc6b11 |
|
|
|
8bc6b11 |
- struct stH stHeader;
|
|
|
8bc6b11 |
-
|
|
|
8bc6b11 |
- /* initialize Header */
|
|
|
8bc6b11 |
- memset(&stHeader, 0x00, sizeof(stHeader));
|
|
|
8bc6b11 |
+ struct stH stHeader = {
|
|
|
8bc6b11 |
+ .magic = FLASHFS_MAGIC,
|
|
|
8bc6b11 |
+ .platform_name = FLASHFS_PLATFORM_MAGIC,
|
|
|
8bc6b11 |
+ .platform_revision = FLASHFS_PLATFORM_REVISION,
|
|
|
8bc6b11 |
+ .ui64FileEnd = -1,
|
|
|
8bc6b11 |
+ };
|
|
|
8bc6b11 |
|
|
|
8bc6b11 |
/* read driver info */
|
|
|
8bc6b11 |
if (NULL != (pcVersion = getenv("DRIVER_NAME"))) {
|
|
|
8bc6b11 |
@@ -104,17 +106,6 @@ createHeaderImage(int notime)
|
|
|
8bc6b11 |
}
|
|
|
8bc6b11 |
memcpy(stHeader.date, &da, 8);
|
|
|
8bc6b11 |
|
|
|
8bc6b11 |
- /* write Magic value into data stream */
|
|
|
8bc6b11 |
- strncpy(stHeader.magic, FLASHFS_MAGIC, 8);
|
|
|
8bc6b11 |
- /* write platform name into data stream */
|
|
|
8bc6b11 |
- strcpy(stHeader.platform_name, FLASHFS_PLATFORM_MAGIC);
|
|
|
8bc6b11 |
- /* write platform revision into data stream */
|
|
|
8bc6b11 |
- strcpy(stHeader.platform_revision, FLASHFS_PLATFORM_REVISION);
|
|
|
8bc6b11 |
-
|
|
|
8bc6b11 |
-
|
|
|
8bc6b11 |
- /* fill end of file info (8 bytes of FF) into data stream */
|
|
|
8bc6b11 |
- stHeader.ui64FileEnd = -1;
|
|
|
8bc6b11 |
-
|
|
|
8bc6b11 |
/* read address of next file and address of header date, both are 64 bit values */
|
|
|
8bc6b11 |
ui64RomAddr = 0;
|
|
|
8bc6b11 |
ui64DataAddr = 0;
|