From nobody Mon May 6 23:37:09 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1610993483; cv=none; d=zohomail.com; s=zohoarc; b=g5hHNixwFVcEGOVWCqtRCkeNfw1NtblfY5Ey5hC4qlGAY1Yc57yyb4XyaIkIF4NSf043kJ1yihnN7cnFHuy12r4c/obS4LnnDN/wonQIyaXDgVoyXbq66pBs1wobu35/4eDa68hWDu3+rZQgmAcKNsnif5aF4jm+pRQ6bpPs7SM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610993483; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:MIME-Version:Message-ID:Subject:To; bh=GzkIFWP7/yMjtaA8FaqnhmJiJIC//oZTSupTc1NCRVs=; b=ZWEbMdIRammRyZqAlzeAugbfytVXFwBufA+OD+69EjVHOBfAdR3U++jakP9Ik41N/XWe5Wk7wCV5abYV3Ta07ybBNNzO1oM/n7XCiqSP1kU5ve3Akx8XdYneURJ+1wTkxtyTxrDl4lu72p/rn/Nj4mdTDRgMiT2vrwagRKp5xe8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1610993483077299.2899005233036; Mon, 18 Jan 2021 10:11:23 -0800 (PST) Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-239-O1POdstXM_iDBFJ_lUgiPA-1; Mon, 18 Jan 2021 13:11:20 -0500 Received: by mail-ed1-f71.google.com with SMTP id n8so6210118edo.19 for ; Mon, 18 Jan 2021 10:11:20 -0800 (PST) Return-Path: Return-Path: Received: from x1w.redhat.com (13.red-83-57-169.dynamicip.rima-tde.net. [83.57.169.13]) by smtp.gmail.com with ESMTPSA id hs18sm9685149ejc.45.2021.01.18.10.11.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Jan 2021 10:11:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1610993482; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=GzkIFWP7/yMjtaA8FaqnhmJiJIC//oZTSupTc1NCRVs=; b=KltLzN5HYvq9IpA9eL+XNif1QWFRJrMmx5QDUii9u04vUO+8Wu3DFiUPZFD4/3wHasv/hZ qWqQPkrxqycYAqhf4RZXjBONRSRWjIEPuqT2yeviGf2hCWksX3Vbd3VAzBAlZ71X5t2j8M M+O36b8UlCIuPNIBT0LeHrZONSjWCvo= X-MC-Unique: O1POdstXM_iDBFJ_lUgiPA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=GzkIFWP7/yMjtaA8FaqnhmJiJIC//oZTSupTc1NCRVs=; b=nLFxMpHYpUBMVfGWVMtQkwChSs2jXsukanTR8Pq+8EEJVm8cuP/EqPpSuoLTMcRxm+ 4f/gYTHMO4wqzmvLSD/DpKKEaJ+KSkvtpIEZH0iAjl+MCxv/VYJhT9FJBhizljhxXY1E dBaWly0KwdvHAbpSTJqEN+Nj4nHPzcl4AMdlqQ0uxGMoVOxMiqnbWEahM+ZXR4jZTCA3 IPncQxkuY57B+N7212RFW3Gnf+2DPeCMBgfDUXl1wPy2xYoX1ZgGS+dw6ozJVLoiFFTY LDvgLD1F/IFqvA27hqJGE61QQ/V81CN6EmI/dnlqn2UJx/h6Nm8wehWeEVmSm6wzK4p2 zdAQ== X-Gm-Message-State: AOAM530uhun+KYBtGgKvqa6King7S/wV4XMbLFVfSvZph9C0KlHz+Uq9 aSpfPXtYW4nDgy0HhO7HTLJSnRFfFk+bR3XFviQ5Mdo/TXt1Hj+TP9COOLpWsQV+euplZ4ckKpP MvyN9Q6Tx9j6Liw== X-Received: by 2002:a17:906:87c3:: with SMTP id zb3mr612841ejb.244.1610993478581; Mon, 18 Jan 2021 10:11:18 -0800 (PST) X-Google-Smtp-Source: ABdhPJzk7TicbShaOxQpKr3LynDdCUOfbE6ZLbwBOoEPW3Zzy/OGjqslwh6Q6qXr+cIgjfXcAwqFDA== X-Received: by 2002:a17:906:87c3:: with SMTP id zb3mr612826ejb.244.1610993478377; Mon, 18 Jan 2021 10:11:18 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , =?UTF-8?q?Daniel=20Berrang=C3=A9?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH] hw/usb/hcd-xhci: Fix extraneous format-truncation error on 32-bit hosts Date: Mon, 18 Jan 2021 19:11:15 +0100 Message-Id: <20210118181115.313742-1-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) For some reason the assert() added in commit ccb799313a5 ("hw/usb: avoid format truncation warning when formatting port name") does not fix when building with GCC 10. KISS and expand the buffer by 4 bytes to silent the following error when using GCC 10.2.1 on Fedora 33: hw/usb/hcd-xhci.c: In function 'usb_xhci_realize': hw/usb/hcd-xhci.c:3309:54: error: '%d' directive output may be truncated = writing between 1 and 8 bytes into a region of size 5 [-Werror=3Dformat-tru= ncation=3D] 3309 | snprintf(port->name, sizeof(port->name), "usb2 port #= %d", i+1); | ^~~~~~~~~~~~= ~~~ hw/usb/hcd-xhci.c:3309:54: note: directive argument in the range [1, 8947= 8486] In file included from /usr/include/stdio.h:866, from include/qemu/osdep.h:85, from hw/usb/hcd-xhci.c:22: /usr/include/bits/stdio2.h:70:10: note: '__builtin___snprintf_chk' output= between 13 and 20 bytes into a destination of size 16 70 | return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL = - 1, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~= ~~~~ 71 | __bos (__s), __fmt, __va_arg_pack ()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ hw/usb/hcd-xhci.c:3323:54: error: '%d' directive output may be truncated = writing between 1 and 8 bytes into a region of size 5 [-Werror=3Dformat-tru= ncation=3D] 3323 | snprintf(port->name, sizeof(port->name), "usb3 port #= %d", i+1); | ^~~~~~~~~~~~= ~~~ hw/usb/hcd-xhci.c:3323:54: note: directive argument in the range [1, 8947= 8486] In file included from /usr/include/stdio.h:866, from include/qemu/osdep.h:85, from hw/usb/hcd-xhci.c:22: /usr/include/bits/stdio2.h:70:10: note: '__builtin___snprintf_chk' output= between 13 and 20 bytes into a destination of size 16 70 | return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL = - 1, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~= ~~~~ 71 | __bos (__s), __fmt, __va_arg_pack ()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ cc1: all warnings being treated as errors Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/usb/hcd-xhci.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/usb/hcd-xhci.h b/hw/usb/hcd-xhci.h index 02ebd764509..7bba361f3bb 100644 --- a/hw/usb/hcd-xhci.h +++ b/hw/usb/hcd-xhci.h @@ -128,7 +128,7 @@ typedef struct XHCIPort { uint32_t portnr; USBPort *uport; uint32_t speedmask; - char name[16]; + char name[20]; MemoryRegion mem; } XHCIPort; =20 --=20 2.26.2