[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-commits] [qemu/qemu] 121829: usb: Fix build with newer gcc

From: GitHub
Subject: [Qemu-commits] [qemu/qemu] 121829: usb: Fix build with newer gcc
Date: Fri, 21 Jul 2017 02:28:25 -0700

  Branch: refs/heads/master
  Home:   https://github.com/qemu/qemu
  Commit: 121829cb2160e9cd82482c1542699fa589688106
  Author: Eric Blake <address@hidden>
  Date:   2017-07-20 (Thu, 20 Jul 2017)

  Changed paths:
    M hw/usb/bus.c

  Log Message:
  usb: Fix build with newer gcc

gcc 7 is pickier about our sources:

hw/usb/bus.c: In function ‘usb_port_location’:
hw/usb/bus.c:410:66: error: ‘%d’ directive output may be truncated writing 
between 1 and 11 bytes into a region of size between 0 and 15 
   snprintf(downstream->path, sizeof(downstream->path), "%s.%d",
hw/usb/bus.c:410:9: note: ‘snprintf’ output between 3 and 28 bytes into a 
destination of size 16
   snprintf(downstream->path, sizeof(downstream->path), "%s.%d",
            upstream->path, portnr);

But we know that there are at most 5 levels of USB hubs, with at
most two digits per level; that plus the separating dots means we
use at most 15 bytes (including trailing NUL) of our 16-byte field.
Adding an assertion to show gcc that we checked for truncation is
enough to shut up the false-positive warning.

Inspired by an idea by Dr. David Alan Gilbert <address@hidden>.

Signed-off-by: Eric Blake <address@hidden>
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
Message-id: address@hidden
Signed-off-by: Gerd Hoffmann <address@hidden>

  Commit: 4439e1f1563a36e3bad31e5d2327d500c1aea109
  Author: Peter Maydell <address@hidden>
  Date:   2017-07-20 (Thu, 20 Jul 2017)

  Changed paths:
    M hw/usb/bus.c

  Log Message:
  Merge remote-tracking branch 'remotes/kraxel/tags/usb-20170720-pull-request' 
into staging

usb: Fix build with newer gcc

# gpg: Signature made Thu 20 Jul 2017 09:44:55 BST
# gpg:                using RSA key 0x4CB6D8EED3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <address@hidden>"
# gpg:                 aka "Gerd Hoffmann <address@hidden>"
# gpg:                 aka "Gerd Hoffmann (private) <address@hidden>"
# Primary key fingerprint: A032 8CFF B93A 17A7 9901  FE7D 4CB6 D8EE D3E8 7138

* remotes/kraxel/tags/usb-20170720-pull-request:
  usb: Fix build with newer gcc

Signed-off-by: Peter Maydell <address@hidden>

Compare: https://github.com/qemu/qemu/compare/25d0233c1ac6...4439e1f1563a

reply via email to

[Prev in Thread] Current Thread [Next in Thread]