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 ‘ppce500_load_device_tree’:
/home/hsp/src/qemu-master/hw/ppc/e500.c:442:37: error: ‘/pic@’
directive output may be truncated writing 5 bytes into a region of
size between 1 and 128 [-Werror=format-truncation=]
      snprintf(mpic, sizeof(mpic), "%s/pic@%llx", soc, 
MPC8544_MPIC_REGS_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 <hsp.c...@gmail.com>
Signed-off-by: Greg Kurz <gr...@kaod.org>
---
  hw/ppc/e500.c |   39 +++++++++++++++++++++++----------------
  1 file changed, 23 insertions(+), 16 deletions(-)


Reviewed-by: Eric Blake <ebl...@redhat.com>

--
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org

Reply via email to