84 lines
2.9 KiB
Diff
84 lines
2.9 KiB
Diff
From e17f0d9c136d4304e53d6f875e25279b838ae476 Mon Sep 17 00:00:00 2001
|
||
From: Laurent Vivier <lvivier@redhat.com>
|
||
Date: Wed, 8 Aug 2018 15:11:01 +0100
|
||
Subject: [PATCH 5/6] romfs/tools: Silence GCC 8.1 compiler warning with
|
||
FLASHFS_MAGIC
|
||
MIME-Version: 1.0
|
||
Content-Type: text/plain; charset=UTF-8
|
||
Content-Transfer-Encoding: 8bit
|
||
|
||
RH-Author: Laurent Vivier <lvivier@redhat.com>
|
||
Message-id: <20180808151102.11232-6-lvivier@redhat.com>
|
||
Patchwork-id: 81684
|
||
O-Subject: [RHEL-8.0 SLOF PATCH 5/6] romfs/tools: Silence GCC 8.1 compiler warning with FLASHFS_MAGIC
|
||
Bugzilla: 1613619
|
||
RH-Acked-by: Thomas Huth <thuth@redhat.com>
|
||
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
|
||
RH-Acked-by: David Gibson <dgibson@redhat.com>
|
||
|
||
From: Thomas Huth <thuth@redhat.com>
|
||
|
||
GCC 8.1 introduce some new warnings which affect create_crc.c. One of
|
||
them is:
|
||
|
||
create_crc.c: In function ‘createHeaderImage’:
|
||
create_crc.c:110:2: warning: ‘strncpy’ output truncated before terminating nul
|
||
copying 8 bytes from a string of the same length [-Wstringop-truncation]
|
||
strncpy(uHeader.stHeader.magic, FLASHFS_MAGIC, 8);
|
||
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||
|
||
Initialize the header struct statically here instead to silence the warning.
|
||
|
||
Suggested-by: Segher Boessenkool <segher@kernel.crashing.org>
|
||
Signed-off-by: Thomas Huth <thuth@redhat.com>
|
||
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
|
||
(cherry picked from commit 49482e06ea74652a70a8cd067b852cc142021c03)
|
||
Signed-off-by: Laurent Vivier <lvivier@redhat.com>
|
||
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
||
---
|
||
romfs/tools/create_crc.c | 21 ++++++---------------
|
||
1 file changed, 6 insertions(+), 15 deletions(-)
|
||
|
||
diff --git a/romfs/tools/create_crc.c b/romfs/tools/create_crc.c
|
||
index e354339..475b184 100644
|
||
--- a/romfs/tools/create_crc.c
|
||
+++ b/romfs/tools/create_crc.c
|
||
@@ -72,10 +72,12 @@ createHeaderImage(int notime)
|
||
char dastr[16] = { 0, };
|
||
unsigned long long da = 0;
|
||
|
||
- struct stH stHeader;
|
||
-
|
||
- /* initialize Header */
|
||
- memset(&stHeader, 0x00, sizeof(stHeader));
|
||
+ struct stH stHeader = {
|
||
+ .magic = FLASHFS_MAGIC,
|
||
+ .platform_name = FLASHFS_PLATFORM_MAGIC,
|
||
+ .platform_revision = FLASHFS_PLATFORM_REVISION,
|
||
+ .ui64FileEnd = -1,
|
||
+ };
|
||
|
||
/* read driver info */
|
||
if (NULL != (pcVersion = getenv("DRIVER_NAME"))) {
|
||
@@ -104,17 +106,6 @@ createHeaderImage(int notime)
|
||
}
|
||
memcpy(stHeader.date, &da, 8);
|
||
|
||
- /* write Magic value into data stream */
|
||
- strncpy(stHeader.magic, FLASHFS_MAGIC, 8);
|
||
- /* write platform name into data stream */
|
||
- strcpy(stHeader.platform_name, FLASHFS_PLATFORM_MAGIC);
|
||
- /* write platform revision into data stream */
|
||
- strcpy(stHeader.platform_revision, FLASHFS_PLATFORM_REVISION);
|
||
-
|
||
-
|
||
- /* fill end of file info (8 bytes of FF) into data stream */
|
||
- stHeader.ui64FileEnd = -1;
|
||
-
|
||
/* read address of next file and address of header date, both are 64 bit values */
|
||
ui64RomAddr = 0;
|
||
ui64DataAddr = 0;
|
||
--
|
||
1.8.3.1
|
||
|