From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47417) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fG0O2-0004BL-Uf for qemu-devel@nongnu.org; Tue, 08 May 2018 07:02:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fG0Nx-0001ag-Ct for qemu-devel@nongnu.org; Tue, 08 May 2018 07:02:27 -0400 Received: from mail-ot0-x244.google.com ([2607:f8b0:4003:c0f::244]:46693) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fG0Nx-0001aE-8A for qemu-devel@nongnu.org; Tue, 08 May 2018 07:02:21 -0400 Received: by mail-ot0-x244.google.com with SMTP id t1-v6so35532585ott.13 for ; Tue, 08 May 2018 04:02:20 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <20180508113425.003c5031@bahia.lan> References: <152568372989.443627.900708381919207053.stgit@bahia.lan> <71b68bd5-e50b-3baa-3f72-f6af78db4e2e@redhat.com> <20180508113425.003c5031@bahia.lan> From: Peter Maydell Date: Tue, 8 May 2018 12:01:59 +0100 Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH] ppc: e500: use g_strdup_printf() instead of snprintf() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Greg Kurz Cc: QEMU Developers , Eric Blake , Howard Spoelstra , qemu-ppc , David Gibson On 8 May 2018 at 10:34, Greg Kurz wrote: > On Mon, 7 May 2018 12:53:45 -0500 > Eric Blake wrote: > >> On 05/07/2018 04:02 AM, Greg Kurz wrote: >> > qemu-system-ppc fails to build with GCC 8.0.1: >> > >> > /home/hsp/src/qemu-master/hw/ppc/e500.c: In function =E2=80=98ppce500_= load_device_tree=E2=80=99: >> > /home/hsp/src/qemu-master/hw/ppc/e500.c:442:37: error: =E2=80=98/pic@= =E2=80=99 >> > directive output may be truncated writing 5 bytes into a region of >> > size between 1 and 128 [-Werror=3Dformat-truncation=3D] >> > snprintf(mpic, sizeof(mpic), "%s/pic@%llx", soc, MPC8544_MPIC_RE= GS_OFFSET); >> > ^~~~~ >> >> > >> > Fix this by converting e500 to use g_strdup_printf()+g_free() instead >> > of snprintf(). This is done globally, even for call sites that don't >> > break build, since this is the preferred practice in QEMU. >> > >> > Reported-by: Howard Spoelstra >> > Signed-off-by: Greg Kurz >> > --- >> > hw/ppc/e500.c | 39 +++++++++++++++++++++++---------------- >> > 1 file changed, 23 insertions(+), 16 deletions(-) >> > >> >> Reviewed-by: Eric Blake >> > > Hi Peter, > > David said the next pull request for ppc would happen in a month. This > patch fixes an annoying build break with recent GCC, and it already > got two positive reviews, is it possible to have it merged upstream ? Sure; applied to master. -- PMM