From patchwork Tue Apr 30 20:09:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 10924145 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2CE9C14B6 for ; Tue, 30 Apr 2019 20:10:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1F91C28D23 for ; Tue, 30 Apr 2019 20:10:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 12CE728D70; Tue, 30 Apr 2019 20:10:50 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.0 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 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.wl.linuxfoundation.org (Postfix) with ESMTPS id A380F28BBD for ; Tue, 30 Apr 2019 20:10:49 +0000 (UTC) Received: from localhost ([127.0.0.1]:52744 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hLZ5U-0003cJ-U2 for patchwork-qemu-devel@patchwork.kernel.org; Tue, 30 Apr 2019 16:10:48 -0400 Received: from eggs.gnu.org ([209.51.188.92]:49225) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hLZ44-0002Sc-PH for qemu-devel@nongnu.org; Tue, 30 Apr 2019 16:09:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hLZ43-00077P-U1 for qemu-devel@nongnu.org; Tue, 30 Apr 2019 16:09:20 -0400 Received: from esa4.hgst.iphmx.com ([216.71.154.42]:18463) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hLZ41-00076X-Af; Tue, 30 Apr 2019 16:09:17 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1556654957; x=1588190957; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-id:content-transfer-encoding: mime-version; bh=t1F3oSyXeXmUcCQnM3yIqeG8yxJbnn+Grz5yfhWD3Dc=; b=VXzFQ++3zcZ6etb7//wxELhWJEHAnIDQQzD91VRTC9qqbowh0m43umcP SzvxxcfSzcOflHoS64CGG0So8EGG6N2t0VS2bfsOKjlhskh5auH+YdCnh spFcJ+8zDrjiSrhB0EkkEt7krXcuWhV/lL41O7caBKxUtT0Na3bjNlZIS YqNZq3ORdWhc5Zu0Fh9d9ccddC7Q4TYjs2SC0bUiysui29fRa1L176GBc y4zpQgv3nGgjxPFQUT/dH6C+OaNMRJt0ZNcz10F5DskgXVBeu9pk8TKOv XmhIxh0k7dIbHG74Fz10zJygVhRki6jc11oUxzXS2LqbZT4KgOue8nQZI A==; X-IronPort-AV: E=Sophos;i="5.60,414,1549900800"; d="scan'208";a="107206353" Received: from mail-bn3nam01lp2057.outbound.protection.outlook.com (HELO NAM01-BN3-obe.outbound.protection.outlook.com) ([104.47.33.57]) by ob1.hgst.iphmx.com with ESMTP; 01 May 2019 04:09:15 +0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sharedspace.onmicrosoft.com; s=selector1-wdc-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=t1F3oSyXeXmUcCQnM3yIqeG8yxJbnn+Grz5yfhWD3Dc=; b=ejd42Y5z63YOzDingheOkwCZ9j92hLCvhbqd044oOfHn15IuVCQ0mJGScKJS3vsbp+/vsVl8bDN7oDgDDyneucE9RquwUJFOd88gIAANajuVW6tKKOYul7Wj+JGgzz3oOkipKI/8FPhjX23Oi0sRLZW54eJoij0/V/hcmHB+QhQ= Received: from BYAPR04MB4901.namprd04.prod.outlook.com (52.135.232.206) by BYAPR04MB5672.namprd04.prod.outlook.com (20.179.57.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1856.10; Tue, 30 Apr 2019 20:09:13 +0000 Received: from BYAPR04MB4901.namprd04.prod.outlook.com ([fe80::4d89:bbf8:952c:3d66]) by BYAPR04MB4901.namprd04.prod.outlook.com ([fe80::4d89:bbf8:952c:3d66%5]) with mapi id 15.20.1835.018; Tue, 30 Apr 2019 20:09:13 +0000 From: Alistair Francis To: "qemu-devel@nongnu.org" Thread-Topic: [PATCH v1 3/5] hw/usb/dev-mtp: Fix GCC 9 build warning Thread-Index: AQHU/5CUO2QL1YlLekGmTofqK2bLDg== Date: Tue, 30 Apr 2019 20:09:13 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.21.0 x-clientproxiedby: BY5PR13CA0009.namprd13.prod.outlook.com (2603:10b6:a03:180::22) To BYAPR04MB4901.namprd04.prod.outlook.com (2603:10b6:a03:4f::14) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alistair.Francis@wdc.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [199.255.44.250] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 613dc384-2da9-4176-5482-08d6cda7b71a x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600141)(711020)(4605104)(4618075)(2017052603328)(7193020); SRVR:BYAPR04MB5672; x-ms-traffictypediagnostic: BYAPR04MB5672: wdcipoutbound: EOP-TRUE x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:669; x-forefront-prvs: 00235A1EEF x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(136003)(346002)(396003)(366004)(376002)(39860400002)(189003)(199004)(99286004)(4326008)(50226002)(71190400001)(71200400001)(7736002)(305945005)(316002)(14444005)(256004)(44832011)(186003)(36756003)(8936002)(6436002)(54906003)(2501003)(11346002)(102836004)(2906002)(26005)(6486002)(446003)(486006)(476003)(2616005)(5660300002)(8676002)(25786009)(6116002)(81156014)(81166006)(72206003)(3846002)(86362001)(66066001)(478600001)(73956011)(6512007)(66556008)(118296001)(66446008)(14454004)(66476007)(66946007)(64756008)(68736007)(53936002)(76176011)(97736004)(52116002)(2351001)(386003)(6506007)(5640700003)(6916009); DIR:OUT; SFP:1102; SCL:1; SRVR:BYAPR04MB5672; H:BYAPR04MB4901.namprd04.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: AFKNN1oeiVDDxF4Ti3yYjNEdNTwFphD1GPn1tlbK/15ied6WPy5WIWgbcnMCzWuF03RXAQY04QDDtmBk9i7G8dy/RHKiaTCGZsWb51udVDWe6yyGmiOCNDKzzKYGyTrB6sCv5zd2JST7aFY3vDpbjCUtbceG0bcv6iEj17W6xNK4FLjsw5Y7ggAVxnSCDKIuI7oQyvTiVhRKnVRM9RbFWnH+kkJ5JzWGDLF4kOuPktGxyUOJCaPKCIuHiMPYyWRN11yxrcNmMlIVN3V9xYqXzUHdLkA9TP0iscEyj95e464nyaYgpBjSu9KDw4/mBAxp5fkv2RW70xPO69+zbjBohKTan4Qx/IH2CR9bHncbPNFKz0LGdL1NJ+yWc7NLPoL+BebCJkJsywRD4jnyreF3nVKevcKIjmEzDmpM+t819Zg= Content-ID: MIME-Version: 1.0 X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-Network-Message-Id: 613dc384-2da9-4176-5482-08d6cda7b71a X-MS-Exchange-CrossTenant-originalarrivaltime: 30 Apr 2019 20:09:13.7334 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: b61c8803-16f3-4c35-9b17-6f65f441df86 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR04MB5672 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 216.71.154.42 Subject: [Qemu-devel] [PATCH v1 3/5] hw/usb/dev-mtp: 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: , Cc: "qemu-trivial@nongnu.org" , "riku.voipio@iki.fi" , "laurent@vivier.eu" , Alistair Francis , "kraxel@redhat.com" , "alistair23@gmail.com" Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Fix this warning with GCC 9 on Fedora 30: hw/usb/dev-mtp.c:1715:36: error: taking address of packed member of ‘struct ’ may result in an unaligned pointer value [-Werror=address-of-packed-member] 1715 | dataset->filename); | ~~~~~~~^~~~~~~~~~ Signed-off-by: Alistair Francis --- hw/usb/dev-mtp.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/hw/usb/dev-mtp.c b/hw/usb/dev-mtp.c index 99548b012d..6de85d99e6 100644 --- a/hw/usb/dev-mtp.c +++ b/hw/usb/dev-mtp.c @@ -1711,9 +1711,22 @@ static void usb_mtp_write_metadata(MTPState *s, uint64_t dlen) assert(!s->write_pending); assert(p != NULL); +/* + * We are about to access a packed struct. We are confident that the pointer + * address won't be unalligned, so we ignore GCC warnings. + */ +#if defined(CONFIG_PRAGMA_DIAGNOSTIC_AVAILABLE) && QEMU_GNUC_PREREQ(9, 0) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Waddress-of-packed-member" +#endif + filename = utf16_to_str(MIN(dataset->length, filename_chars), dataset->filename); +#if defined(CONFIG_PRAGMA_DIAGNOSTIC_AVAILABLE) && QEMU_GNUC_PREREQ(9, 0) +#pragma GCC diagnostic pop +#endif + if (strchr(filename, '/')) { usb_mtp_queue_result(s, RES_PARAMETER_NOT_SUPPORTED, d->trans, 0, 0, 0, 0);