From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([209.51.188.92]:50728) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hLlmD-0006x5-8D for qemu-devel@nongnu.org; Wed, 01 May 2019 05:43:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hLlm8-0007fF-LX for qemu-devel@nongnu.org; Wed, 01 May 2019 05:43:44 -0400 Date: Wed, 1 May 2019 10:43:31 +0100 From: Daniel =?utf-8?B?UC4gQmVycmFuZ8Op?= Message-ID: <20190501094331.GP29808@redhat.com> Reply-To: Daniel =?utf-8?B?UC4gQmVycmFuZ8Op?= References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v2 2/5] hw/usb/hcd-xhci: Fix GCC 9 build warning List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alistair Francis Cc: "qemu-devel@nongnu.org" , "alistair23@gmail.com" , "kraxel@redhat.com" , "riku.voipio@iki.fi" , "laurent@vivier.eu" , "qemu-trivial@nongnu.org" On Tue, Apr 30, 2019 at 11:28:31PM +0000, Alistair Francis wrote: > Fix this build warning with GCC 9 on Fedora 30: > hw/usb/hcd-xhci.c:3339:66: error: =E2=80=98%d=E2=80=99 directive output= may be truncated writing between 1 and 10 bytes into a region of size 5 = [-Werror=3Dformat-truncation=3D] > 3339 | snprintf(port->name, sizeof(port->name), "usb2 port= #%d", i+1); > | = ^~ > hw/usb/hcd-xhci.c:3339:54: note: directive argument in the range [1, 21= 47483647] > 3339 | snprintf(port->name, sizeof(port->name), "usb2 port= #%d", i+1); > | ^~~~~~~~~~= ~~~~~ > In file included from /usr/include/stdio.h:867, > from /home/alistair/qemu/include/qemu/osdep.h:99, > from hw/usb/hcd-xhci.c:21: > /usr/include/bits/stdio2.h:67:10: note: =E2=80=98__builtin___snprintf_c= hk=E2=80=99 output between 13 and 22 bytes into a destination of size 16 > 67 | return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVE= L - 1, > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~= ~~~~~~ > 68 | __bos (__s), __fmt, __va_arg_pack ()); > | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >=20 > Signed-off-by: Alistair Francis > --- > hw/usb/hcd-xhci.c | 1 + > 1 file changed, 1 insertion(+) >=20 > diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c > index ec28bee319..2b061772b2 100644 > --- a/hw/usb/hcd-xhci.c > +++ b/hw/usb/hcd-xhci.c > @@ -3322,6 +3322,7 @@ static void usb_xhci_init(XHCIState *xhci) > usb_bus_new(&xhci->bus, sizeof(xhci->bus), &xhci_bus_ops, dev); > =20 > for (i =3D 0; i < usbports; i++) { > + g_assert(i < MAX(MAXPORTS_2, MAXPORTS_3)); > speedmask =3D 0; > if (i < xhci->numports_2) { > if (xhci_get_flag(xhci, XHCI_FLAG_SS_FIRST)) { I proposed a slightly different fix here: https://lists.gnu.org/archive/html/qemu-devel/2019-04/msg02125.html but both have the same effect Reviewed-by: Daniel P. Berrang=C3=A9 Regards, Daniel --=20 |: https://berrange.com -o- https://www.flickr.com/photos/dberran= ge :| |: https://libvirt.org -o- https://fstop138.berrange.c= om :| |: https://entangle-photo.org -o- https://www.instagram.com/dberran= ge :| From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.3 required=3.0 tests=FROM_EXCESS_BASE64, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_PASS,URIBL_BLOCKED,USER_AGENT_MUTT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5EADBC43219 for ; Wed, 1 May 2019 09:45:22 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2EFA321670 for ; Wed, 1 May 2019 09:45:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2EFA321670 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([127.0.0.1]:48974 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hLlnl-0007ze-E5 for qemu-devel@archiver.kernel.org; Wed, 01 May 2019 05:45:21 -0400 Received: from eggs.gnu.org ([209.51.188.92]:50728) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hLlmD-0006x5-8D for qemu-devel@nongnu.org; Wed, 01 May 2019 05:43:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hLlm8-0007fF-LX for qemu-devel@nongnu.org; Wed, 01 May 2019 05:43:44 -0400 Received: from mx1.redhat.com ([209.132.183.28]:44122) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hLlm8-0007ei-CK; Wed, 01 May 2019 05:43:40 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7719C99CE3; Wed, 1 May 2019 09:43:39 +0000 (UTC) Received: from redhat.com (ovpn-112-28.ams2.redhat.com [10.36.112.28]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 69144171B7; Wed, 1 May 2019 09:43:34 +0000 (UTC) Date: Wed, 1 May 2019 10:43:31 +0100 From: Daniel =?utf-8?B?UC4gQmVycmFuZ8Op?= To: Alistair Francis Message-ID: <20190501094331.GP29808@redhat.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.11.3 (2019-02-01) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Wed, 01 May 2019 09:43:39 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: Re: [Qemu-devel] [PATCH v2 2/5] hw/usb/hcd-xhci: Fix GCC 9 build warning X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Daniel =?utf-8?B?UC4gQmVycmFuZ8Op?= Cc: "qemu-trivial@nongnu.org" , "riku.voipio@iki.fi" , "laurent@vivier.eu" , "qemu-devel@nongnu.org" , "kraxel@redhat.com" , "alistair23@gmail.com" Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Message-ID: <20190501094331.q5jhKb4n9_tln4M4NBT6jtgd9Ey9lzM4NBRWkfybkuc@z> On Tue, Apr 30, 2019 at 11:28:31PM +0000, Alistair Francis wrote: > Fix this build warning with GCC 9 on Fedora 30: > hw/usb/hcd-xhci.c:3339:66: error: =E2=80=98%d=E2=80=99 directive output= may be truncated writing between 1 and 10 bytes into a region of size 5 = [-Werror=3Dformat-truncation=3D] > 3339 | snprintf(port->name, sizeof(port->name), "usb2 port= #%d", i+1); > | = ^~ > hw/usb/hcd-xhci.c:3339:54: note: directive argument in the range [1, 21= 47483647] > 3339 | snprintf(port->name, sizeof(port->name), "usb2 port= #%d", i+1); > | ^~~~~~~~~~= ~~~~~ > In file included from /usr/include/stdio.h:867, > from /home/alistair/qemu/include/qemu/osdep.h:99, > from hw/usb/hcd-xhci.c:21: > /usr/include/bits/stdio2.h:67:10: note: =E2=80=98__builtin___snprintf_c= hk=E2=80=99 output between 13 and 22 bytes into a destination of size 16 > 67 | return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVE= L - 1, > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~= ~~~~~~ > 68 | __bos (__s), __fmt, __va_arg_pack ()); > | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >=20 > Signed-off-by: Alistair Francis > --- > hw/usb/hcd-xhci.c | 1 + > 1 file changed, 1 insertion(+) >=20 > diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c > index ec28bee319..2b061772b2 100644 > --- a/hw/usb/hcd-xhci.c > +++ b/hw/usb/hcd-xhci.c > @@ -3322,6 +3322,7 @@ static void usb_xhci_init(XHCIState *xhci) > usb_bus_new(&xhci->bus, sizeof(xhci->bus), &xhci_bus_ops, dev); > =20 > for (i =3D 0; i < usbports; i++) { > + g_assert(i < MAX(MAXPORTS_2, MAXPORTS_3)); > speedmask =3D 0; > if (i < xhci->numports_2) { > if (xhci_get_flag(xhci, XHCI_FLAG_SS_FIRST)) { I proposed a slightly different fix here: https://lists.gnu.org/archive/html/qemu-devel/2019-04/msg02125.html but both have the same effect Reviewed-by: Daniel P. Berrang=C3=A9 Regards, Daniel --=20 |: https://berrange.com -o- https://www.flickr.com/photos/dberran= ge :| |: https://libvirt.org -o- https://fstop138.berrange.c= om :| |: https://entangle-photo.org -o- https://www.instagram.com/dberran= ge :|