Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp3394055rwa; Tue, 23 Aug 2022 04:10:13 -0700 (PDT) X-Google-Smtp-Source: AA6agR6qOTfFzx0rn7sYtv8VtzLIFulYulgQofchiEjTroER2OZwhjRTIwkExo+dJS7DNmcX9zlZ X-Received: by 2002:a17:902:6b07:b0:172:a76d:7cc5 with SMTP id o7-20020a1709026b0700b00172a76d7cc5mr23991127plk.128.1661253012895; Tue, 23 Aug 2022 04:10:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661253012; cv=none; d=google.com; s=arc-20160816; b=zcceLxj2/eOVFvI+WrpDjoJ4gU6KclGNa4hwE01xHaAVpGuAP7agBAcxHfjkUyXBva tNX5IkafEvSNLH0upAHoqJauA/jALdphSLN5j/5BAakz7QYaUzEvROZecQyWF3U3szi2 oLO6f/1IJlZlBnkI8ArXoGDjB+xi42+VLHn1jppN5G1JPND0UAlbFTGRHp481xdtCcCa ta+IKcj57V8pXsq63yqXmUteVUO1j9cHF6T3rVrgy9EjRK5pGDP3rFmBraTMKjQi3Tnl S/2CJzRsWXGsGgZGJ4gD4FV3/w8TtR0yX1vLsJYvP3Ja/xukz/6GkTB5feoxEsTQBBIX QsPA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=8+yQX56oQs0hIo3J2kYle5aG15NYVJUvMCGknlph7Q4=; b=v6vmP1prHardK68B6CEVHnwNJUiRtHG1P/GYY0H3JDvNH3xre4qrtjuuDbB6GvFJt5 XUi4U7dvUvm0WXp72yXZtSM9QoYSoitQTa6z11Rd0Ql4/g7h3137+WEhAfAkCdxyP2fs Zyzw5RMOJrqUME7fDcsJIYgOs9v9/zF60yOB6ed5ZjcTkK9N+njY90fXMFo3039jpJc8 1pzVb2g1VKSIwfAYwImq9dwXciLpABTbp1n/MtJ0MUWgUrNn3CP1tSjW6FRle/xaP9wa L/gEgOw08V82A3dmc9TftZWt5kla1zIP4aCm0TYfGRAC366P1OKkiGeETpHMEwZTx9QW rROw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=chVUCmH6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nd10-20020a17090b4cca00b001fb395f4814si5249896pjb.180.2022.08.23.04.10.01; Tue, 23 Aug 2022 04:10:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=chVUCmH6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353980AbiHWKMX (ORCPT + 99 others); Tue, 23 Aug 2022 06:12:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43774 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352408AbiHWKFk (ORCPT ); Tue, 23 Aug 2022 06:05:40 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A9678A2858; Tue, 23 Aug 2022 01:52:02 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id D14B2CE1B4B; Tue, 23 Aug 2022 08:52:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D22B0C433D6; Tue, 23 Aug 2022 08:51:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661244719; bh=xbUiAn6roGKlOVmttkOBenGDG4+k4twIaoCVAlzAAPA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=chVUCmH6Bd2UQVMUaUOTQys6q6HYYcivPsreQkDiA5NIkCze0sKzSVsIAIh3ZaM6w /jYa5BdDWHJklO5c7pqD4VJ21Nq+2RkuPxw46toiie24Wu8+rEU5VgsIp+l0yd37Za li5kTp6dGcOlP9X7nGMdxzjq+H2Ls9mz+fq/TJJ8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Gerhard Uttenthaler , Sebastian Haas , Marc Kleine-Budde Subject: [PATCH 4.14 180/229] can: ems_usb: fix clangs -Wunaligned-access warning Date: Tue, 23 Aug 2022 10:25:41 +0200 Message-Id: <20220823080100.047311786@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080053.202747790@linuxfoundation.org> References: <20220823080053.202747790@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Marc Kleine-Budde commit a4cb6e62ea4d36e53fb3c0f18ea4503d7b76674f upstream. clang emits a -Wunaligned-access warning on struct __packed ems_cpc_msg. The reason is that the anonymous union msg (not declared as packed) is being packed right after some non naturally aligned variables (3*8 bits + 2*32) inside a packed struct: | struct __packed ems_cpc_msg { | u8 type; /* type of message */ | u8 length; /* length of data within union 'msg' */ | u8 msgid; /* confirmation handle */ | __le32 ts_sec; /* timestamp in seconds */ | __le32 ts_nsec; /* timestamp in nano seconds */ | /* ^ not naturally aligned */ | | union { | /* ^ not declared as packed */ | u8 generic[64]; | struct cpc_can_msg can_msg; | struct cpc_can_params can_params; | struct cpc_confirm confirmation; | struct cpc_overrun overrun; | struct cpc_can_error error; | struct cpc_can_err_counter err_counter; | u8 can_state; | } msg; | }; Starting from LLVM 14, having an unpacked struct nested in a packed struct triggers a warning. c.f. [1]. Fix the warning by marking the anonymous union as packed. [1] https://github.com/llvm/llvm-project/issues/55520 Fixes: 702171adeed3 ("ems_usb: Added support for EMS CPC-USB/ARM7 CAN/USB interface") Link: https://lore.kernel.org/all/20220802094021.959858-1-mkl@pengutronix.de Cc: Gerhard Uttenthaler Cc: Sebastian Haas Signed-off-by: Marc Kleine-Budde Signed-off-by: Greg Kroah-Hartman --- drivers/net/can/usb/ems_usb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/net/can/usb/ems_usb.c +++ b/drivers/net/can/usb/ems_usb.c @@ -206,7 +206,7 @@ struct __packed ems_cpc_msg { __le32 ts_sec; /* timestamp in seconds */ __le32 ts_nsec; /* timestamp in nano seconds */ - union { + union __packed { u8 generic[64]; struct cpc_can_msg can_msg; struct cpc_can_params can_params;