cryptospore / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

Blame SOURCES/kvm-acpi-build-Fix-compiler-warning-missing-gnu_printf-f.patch

0a122b
From e1826a5a94d53d337a0e0e18230d81b572173ba7 Mon Sep 17 00:00:00 2001
0a122b
Message-Id: <e1826a5a94d53d337a0e0e18230d81b572173ba7.1387298827.git.minovotn@redhat.com>
0a122b
In-Reply-To: <3ed0fb61a3dc912ef036d7ef450bed192090709e.1387298827.git.minovotn@redhat.com>
0a122b
References: <3ed0fb61a3dc912ef036d7ef450bed192090709e.1387298827.git.minovotn@redhat.com>
0a122b
From: "Michael S. Tsirkin" <mst@redhat.com>
0a122b
Date: Tue, 17 Dec 2013 15:19:27 +0100
0a122b
Subject: [PATCH 55/56] acpi-build: Fix compiler warning (missing gnu_printf
0a122b
 format attribute)
0a122b
MIME-Version: 1.0
0a122b
Content-Type: text/plain; charset=UTF-8
0a122b
Content-Transfer-Encoding: 8bit
0a122b
0a122b
RH-Author: Michael S. Tsirkin <mst@redhat.com>
0a122b
Message-id: <1387293161-4085-56-git-send-email-mst@redhat.com>
0a122b
Patchwork-id: 56361
0a122b
O-Subject: [PATCH qemu-kvm RHEL7.0 v2 55/57] acpi-build: Fix compiler warning (missing gnu_printf format attribute)
0a122b
Bugzilla: 1034876
0a122b
RH-Acked-by: Igor Mammedov <imammedo@redhat.com>
0a122b
RH-Acked-by: Marcel Apfelbaum <marcel.a@redhat.com>
0a122b
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
0a122b
0a122b
From: Stefan Weil <sw@weilnetz.de>
0a122b
0a122b
gcc 4.8.2 reports this warning when extra warnings are enabled (-Wextra):
0a122b
0a122b
  CC    m68k-softmmu/hw/m68k/mcf5206.o
0a122b
hw/i386/acpi-build.c: In function ‘build_append_nameseg’:
0a122b
hw/i386/acpi-build.c:294:5: error:
0a122b
 function might be possible candidate for ‘gnu_printf’ format attribute [-Werror=suggest-attribute=format]
0a122b
     g_string_vprintf(s, format, args);
0a122b
     ^
0a122b
0a122b
When this warning is fixed, there is a new compiler warning:
0a122b
0a122b
  CC    i386-softmmu/hw/i386/acpi-build.o
0a122b
hw/i386/acpi-build.c: In function ‘build_append_notify’:
0a122b
hw/i386/acpi-build.c:632:5: error:
0a122b
 format not a string literal and no format arguments [-Werror=format-security]
0a122b
     build_append_nameseg(method, name);
0a122b
     ^
0a122b
0a122b
This is fixed here, too.
0a122b
0a122b
Signed-off-by: Stefan Weil <sw@weilnetz.de>
0a122b
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
0a122b
(cherry picked from commit 867d898ccf50ef095b95c403d7dc809c188b14e2)
0a122b
---
0a122b
 hw/i386/acpi-build.c | 5 +++--
0a122b
 1 file changed, 3 insertions(+), 2 deletions(-)
0a122b
0a122b
Signed-off-by: Michal Novotny <minovotn@redhat.com>
0a122b
---
0a122b
 hw/i386/acpi-build.c | 5 +++--
0a122b
 1 file changed, 3 insertions(+), 2 deletions(-)
0a122b
0a122b
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
0a122b
index 316d6d3..2d008bd 100644
0a122b
--- a/hw/i386/acpi-build.c
0a122b
+++ b/hw/i386/acpi-build.c
0a122b
@@ -285,7 +285,8 @@ static inline void build_append_array(GArray *array, GArray *val)
0a122b
     g_array_append_vals(array, val->data, val->len);
0a122b
 }
0a122b
 
0a122b
-static void build_append_nameseg(GArray *array, const char *format, ...)
0a122b
+static void GCC_FMT_ATTR(2, 3)
0a122b
+build_append_nameseg(GArray *array, const char *format, ...)
0a122b
 {
0a122b
     /* It would be nicer to use g_string_vprintf but it's only there in 2.22 */
0a122b
     char s[] = "XXXX";
0a122b
@@ -630,7 +631,7 @@ build_append_notify(GArray *device, const char *name,
0a122b
     GArray *method = build_alloc_array();
0a122b
     uint8_t op = 0x14; /* MethodOp */
0a122b
 
0a122b
-    build_append_nameseg(method, name);
0a122b
+    build_append_nameseg(method, "%s", name);
0a122b
     build_append_byte(method, 0x02); /* MethodFlags: ArgCount */
0a122b
     for (i = skip; i < count; i++) {
0a122b
         GArray *target = build_alloc_array();
0a122b
-- 
0a122b
1.7.11.7
0a122b