From patchwork Thu Aug 29 14:46:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 1155376 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.intel.com Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 46K7fP74KQz9sDB for ; Fri, 30 Aug 2019 02:41:17 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id D0AB7C21DB5; Thu, 29 Aug 2019 14:46:16 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 3993DC21D83; Thu, 29 Aug 2019 14:46:15 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 5C320C21D83; Thu, 29 Aug 2019 14:46:13 +0000 (UTC) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by lists.denx.de (Postfix) with ESMTPS id 812EEC21C2F for ; Thu, 29 Aug 2019 14:46:12 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 29 Aug 2019 07:46:10 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,443,1559545200"; d="scan'208";a="188565715" Received: from black.fi.intel.com ([10.237.72.28]) by FMSMGA003.fm.intel.com with ESMTP; 29 Aug 2019 07:46:09 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 516BCBD; Thu, 29 Aug 2019 17:46:08 +0300 (EEST) From: Andy Shevchenko To: u-boot@lists.denx.de, Simon Glass , Bin Meng , Vivek Gautam , =?utf-8?q?=C5=81ukasz_Majewski?= Date: Thu, 29 Aug 2019 17:46:07 +0300 Message-Id: <20190829144607.36233-1-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.23.0.rc1 MIME-Version: 1.0 Cc: Andy Shevchenko Subject: [U-Boot] [PATCH v1] usb: Guarantee alignment of the string descriptor X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" GCC 9.x starts complaining about potential misalignment of the pointer to the array (in this case alignment=2) in the packed (alignment=1) structures. drivers/usb/gadget/composite.c:545:23: warning: taking address of packed member of ‘struct usb_string_descriptor’ may result in an unaligned pointer value [-Waddress-of-packed-member] 545 | collect_langs(sp, s->wData); drivers/usb/gadget/composite.c:550:24: warning: taking address of packed member of ‘struct usb_string_descriptor’ may result in an unaligned pointer value [-Waddress-of-packed-member] 550 | collect_langs(sp, s->wData); drivers/usb/gadget/composite.c:555:25: warning: taking address of packed member of ‘struct usb_string_descriptor’ may result in an unaligned pointer value [-Waddress-of-packed-member] 555 | collect_langs(sp, s->wData); Define structure alignment to be 2 to guarantee alignment of its members. Signed-off-by: Andy Shevchenko Reviewed-by: Bin Meng --- include/linux/usb/ch9.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/usb/ch9.h b/include/linux/usb/ch9.h index 264c9712a3..a9b3c2709a 100644 --- a/include/linux/usb/ch9.h +++ b/include/linux/usb/ch9.h @@ -336,7 +336,7 @@ struct usb_string_descriptor { __u8 bDescriptorType; __le16 wData[1]; /* UTF-16LE encoded */ -} __attribute__ ((packed)); +} __attribute__ ((packed, aligned(2))); /* note that "string" zero is special, it holds language codes that * the device supports, not Unicode characters.