From patchwork Fri Dec 6 19:15:33 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Tokarev X-Patchwork-Id: 298232 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id D9AFC2C00A6 for ; Sat, 7 Dec 2013 06:36:27 +1100 (EST) Received: from localhost ([::1]:33165 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vp1Ac-0000qB-Ma for incoming@patchwork.ozlabs.org; Fri, 06 Dec 2013 14:34:38 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53412) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vp18x-00027d-23 for qemu-devel@nongnu.org; Fri, 06 Dec 2013 14:32:59 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Vp18q-0002r2-Lw for qemu-devel@nongnu.org; Fri, 06 Dec 2013 14:32:54 -0500 Received: from isrv.corpit.ru ([86.62.121.231]:33925) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vp18q-0002qU-EV; Fri, 06 Dec 2013 14:32:48 -0500 Received: from tsrv.corpit.ru (tsrv.tls.msk.ru [192.168.177.2]) by isrv.corpit.ru (Postfix) with ESMTP id 42E2B40DD2; Fri, 6 Dec 2013 23:32:47 +0400 (MSK) Received: from tls.msk.ru (mjt.vpn.tls.msk.ru [192.168.177.99]) by tsrv.corpit.ru (Postfix) with SMTP id 4F016603; Fri, 6 Dec 2013 23:15:45 +0400 (MSK) Received: (nullmailer pid 19220 invoked by uid 1000); Fri, 06 Dec 2013 19:15:43 -0000 From: Michael Tokarev To: aliguori@amazon.com Date: Fri, 6 Dec 2013 23:15:33 +0400 Message-Id: <1386357341-19147-7-git-send-email-mjt@msgid.tls.msk.ru> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1386357341-19147-1-git-send-email-mjt@msgid.tls.msk.ru> References: <1386357341-19147-1-git-send-email-mjt@msgid.tls.msk.ru> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 86.62.121.231 Cc: qemu-trivial@nongnu.org, Stefan Weil , Michael Tokarev , qemu-devel@nongnu.org Subject: [Qemu-devel] [PULL 06/14] acpi-build: Fix compiler warning (missing gnu_printf format attribute) X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Stefan Weil gcc 4.8.2 reports this warning when extra warnings are enabled (-Wextra): CC m68k-softmmu/hw/m68k/mcf5206.o hw/i386/acpi-build.c: In function ‘build_append_nameseg’: hw/i386/acpi-build.c:294:5: error: function might be possible candidate for ‘gnu_printf’ format attribute [-Werror=suggest-attribute=format] g_string_vprintf(s, format, args); ^ When this warning is fixed, there is a new compiler warning: CC i386-softmmu/hw/i386/acpi-build.o hw/i386/acpi-build.c: In function ‘build_append_notify’: hw/i386/acpi-build.c:632:5: error: format not a string literal and no format arguments [-Werror=format-security] build_append_nameseg(method, name); ^ This is fixed here, too. Signed-off-by: Stefan Weil Signed-off-by: Michael Tokarev --- hw/i386/acpi-build.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 1f22fb6..befc39f 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -285,7 +285,8 @@ static inline void build_append_array(GArray *array, GArray *val) g_array_append_vals(array, val->data, val->len); } -static void build_append_nameseg(GArray *array, const char *format, ...) +static void GCC_FMT_ATTR(2, 3) +build_append_nameseg(GArray *array, const char *format, ...) { /* It would be nicer to use g_string_vprintf but it's only there in 2.22 */ char s[] = "XXXX"; @@ -630,7 +631,7 @@ build_append_notify(GArray *device, const char *name, GArray *method = build_alloc_array(); uint8_t op = 0x14; /* MethodOp */ - build_append_nameseg(method, name); + build_append_nameseg(method, "%s", name); build_append_byte(method, 0x02); /* MethodFlags: ArgCount */ for (i = skip; i < count; i++) { GArray *target = build_alloc_array();