From 62e852c00d2d48a3e4d04b865d2abe699b91ec7a92b5b9c565c48cfe3f5cec54 Mon Sep 17 00:00:00 2001 From: Bruce Rogers Date: Thu, 26 Apr 2018 18:53:21 +0000 Subject: [PATCH] Accepting request 601676 from home:bfrogers:branches:Virtualization - Guard strncpy call with GCC pragma to disable warning about possible incorrect usage, when in fact it is correct. This is for gcc 8 compatibility (bsc#1090355) ipxe-efi-guard-strncpy-with-gcc-warning-ignore-pragma.patch - Add WantedBy for enable qemu-ga@.service auto start (bsc#1090369) - Guard strncpy call with GCC pragma to disable warning about possible incorrect usage, when in fact it is correct. This is for gcc 8 compatibility (bsc#1090355) ipxe-efi-guard-strncpy-with-gcc-warning-ignore-pragma.patch - Add WantedBy for enable qemu-ga@.service auto start (bsc#1090369) OBS-URL: https://build.opensuse.org/request/show/601676 OBS-URL: https://build.opensuse.org/package/show/Virtualization/qemu?expand=0&rev=406 --- ...rncpy-with-gcc-warning-ignore-pragma.patch | 43 +++++++++++++++++++ qemu-ga@.service | 3 ++ qemu-testsuite.changes | 13 ++++++ qemu-testsuite.spec | 2 + qemu.changes | 13 ++++++ qemu.spec | 2 + qemu.spec.in | 2 + 7 files changed, 78 insertions(+) create mode 100644 ipxe-efi-guard-strncpy-with-gcc-warning-ignore-pragma.patch diff --git a/ipxe-efi-guard-strncpy-with-gcc-warning-ignore-pragma.patch b/ipxe-efi-guard-strncpy-with-gcc-warning-ignore-pragma.patch new file mode 100644 index 00000000..884b5c78 --- /dev/null +++ b/ipxe-efi-guard-strncpy-with-gcc-warning-ignore-pragma.patch @@ -0,0 +1,43 @@ +From cd6ca646c12371f0146d43ea5a6b7574342c2a7f Mon Sep 17 00:00:00 2001 +From: Bruce Rogers +Date: Wed, 25 Apr 2018 10:26:28 -0600 +Subject: [PATCH] [efi] guard strncpy with gcc warning ignore pragma + +Using gcc 8 with the -Wstringop-truncation option, and with warnings +treated as errors, the following error is emitted: + +util/elf2efi.c:494:2: error: 'strncpy' specified bound 8 equals destination +size [-Werror=stringop-truncation] + strncpy ( ( char * ) new->hdr.Name, name, sizeof ( new->hdr.Name ) ); + ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Use gcc pragmas surrounding this line of code which avoid this warning. The +strncpy usage here is correct. + +[BR: BSC#1090355] +Signed-off-by: Bruce Rogers +--- + src/util/elf2efi.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/src/util/elf2efi.c b/src/util/elf2efi.c +index 6718df77..93cdda03 100644 +--- a/src/util/elf2efi.c ++++ b/src/util/elf2efi.c +@@ -494,7 +494,13 @@ static struct pe_section * process_section ( struct elf_file *elf, + memset ( new, 0, sizeof ( *new ) + section_filesz ); + + /* Fill in section header details */ ++/* gcc 8 warning gives false positive here - our usage is correct */ ++#pragma GCC diagnostic push ++#if __GNUC__ >= 8 ++#pragma GCC diagnostic ignored "-Wstringop-truncation" ++#endif + strncpy ( ( char * ) new->hdr.Name, name, sizeof ( new->hdr.Name ) ); ++#pragma GCC diagnostic pop + new->hdr.Misc.VirtualSize = section_memsz; + new->hdr.VirtualAddress = shdr->sh_addr; + new->hdr.SizeOfRawData = section_filesz; +-- +2.16.3 + diff --git a/qemu-ga@.service b/qemu-ga@.service index 63605e61..ba43b6d0 100644 --- a/qemu-ga@.service +++ b/qemu-ga@.service @@ -9,3 +9,6 @@ Type=simple ExecStart=-/usr/bin/qemu-ga -p /dev/%I Restart=always RestartSec=0 + +[Install] +WantedBy=dev-%i.device diff --git a/qemu-testsuite.changes b/qemu-testsuite.changes index 4c35f5f7..307ec92b 100644 --- a/qemu-testsuite.changes +++ b/qemu-testsuite.changes @@ -1,3 +1,16 @@ +------------------------------------------------------------------- +Thu Apr 26 17:20:01 UTC 2018 - brogers@suse.com + +- Guard strncpy call with GCC pragma to disable warning about possible + incorrect usage, when in fact it is correct. This is for gcc 8 + compatibility (bsc#1090355) + ipxe-efi-guard-strncpy-with-gcc-warning-ignore-pragma.patch + +------------------------------------------------------------------- +Mon Apr 23 13:02:30 UTC 2018 - lma@suse.com + +- Add WantedBy for enable qemu-ga@.service auto start (bsc#1090369) + ------------------------------------------------------------------- Tue Apr 10 10:50:31 UTC 2018 - kwalter@suse.com diff --git a/qemu-testsuite.spec b/qemu-testsuite.spec index a8b25449..3fc2fbbf 100644 --- a/qemu-testsuite.spec +++ b/qemu-testsuite.spec @@ -225,6 +225,7 @@ Patch1101: seabios-switch-to-python3-as-needed.patch # PATCH-FIX-OPENSUSE ipxe-stable-buildid.patch brogers@suse.com -- reproducible builds Patch1200: ipxe-stable-buildid.patch Patch1201: ipxe-use-gcc6-for-more-compact-code.patch +Patch1202: ipxe-efi-guard-strncpy-with-gcc-warning-ignore-pragma.patch # sgabios # PATCH-FIX-OPENSUSE sgabios-stable-buildid.patch brogers@suse.com -- reproducible builds @@ -906,6 +907,7 @@ pushd roms/ipxe %if 0%{?suse_version} <= 1320 %patch1201 -p1 %endif +%patch1202 -p1 popd pushd roms/sgabios diff --git a/qemu.changes b/qemu.changes index 4c35f5f7..307ec92b 100644 --- a/qemu.changes +++ b/qemu.changes @@ -1,3 +1,16 @@ +------------------------------------------------------------------- +Thu Apr 26 17:20:01 UTC 2018 - brogers@suse.com + +- Guard strncpy call with GCC pragma to disable warning about possible + incorrect usage, when in fact it is correct. This is for gcc 8 + compatibility (bsc#1090355) + ipxe-efi-guard-strncpy-with-gcc-warning-ignore-pragma.patch + +------------------------------------------------------------------- +Mon Apr 23 13:02:30 UTC 2018 - lma@suse.com + +- Add WantedBy for enable qemu-ga@.service auto start (bsc#1090369) + ------------------------------------------------------------------- Tue Apr 10 10:50:31 UTC 2018 - kwalter@suse.com diff --git a/qemu.spec b/qemu.spec index b45081bb..9730b0e5 100644 --- a/qemu.spec +++ b/qemu.spec @@ -225,6 +225,7 @@ Patch1101: seabios-switch-to-python3-as-needed.patch # PATCH-FIX-OPENSUSE ipxe-stable-buildid.patch brogers@suse.com -- reproducible builds Patch1200: ipxe-stable-buildid.patch Patch1201: ipxe-use-gcc6-for-more-compact-code.patch +Patch1202: ipxe-efi-guard-strncpy-with-gcc-warning-ignore-pragma.patch # sgabios # PATCH-FIX-OPENSUSE sgabios-stable-buildid.patch brogers@suse.com -- reproducible builds @@ -906,6 +907,7 @@ pushd roms/ipxe %if 0%{?suse_version} <= 1320 %patch1201 -p1 %endif +%patch1202 -p1 popd pushd roms/sgabios diff --git a/qemu.spec.in b/qemu.spec.in index 7ee3a71f..af250aab 100644 --- a/qemu.spec.in +++ b/qemu.spec.in @@ -147,6 +147,7 @@ Patch1101: seabios-switch-to-python3-as-needed.patch # PATCH-FIX-OPENSUSE ipxe-stable-buildid.patch brogers@suse.com -- reproducible builds Patch1200: ipxe-stable-buildid.patch Patch1201: ipxe-use-gcc6-for-more-compact-code.patch +patch1202: ipxe-efi-guard-strncpy-with-gcc-warning-ignore-pragma.patch # sgabios # PATCH-FIX-OPENSUSE sgabios-stable-buildid.patch brogers@suse.com -- reproducible builds @@ -749,6 +750,7 @@ pushd roms/ipxe %if 0%{?suse_version} <= 1320 %patch1201 -p1 %endif +%patch1202 -p1 popd pushd roms/sgabios