Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp3323400rwa; Tue, 23 Aug 2022 02:50:34 -0700 (PDT) X-Google-Smtp-Source: AA6agR5fdpkBpVqPDTo8hSDEz7OjbOE3p8xRgNgQqBL/3+wBhY+bUWVSTu/KQNGm3aADltPXGx4X X-Received: by 2002:a17:907:6e1c:b0:73d:7806:3c5e with SMTP id sd28-20020a1709076e1c00b0073d78063c5emr7387849ejc.36.1661248234227; Tue, 23 Aug 2022 02:50:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661248234; cv=none; d=google.com; s=arc-20160816; b=Voc+xr4sXB6MSgGDozMUPVE/jpDlxRb3Z+8WJjDmi2KS4DG+gRiOl0CfVSws+yUtAN ESO5MVjITFRufDdKBSFN0BEJkPKWhqC7t28/gTIIfC7EpckJTGirg56WC0lMXnuV9R1Q 0pPG9fORctF2t3iA1FyChN/sj1E0h0UeTf3Z5xPINZ3SE4FqsKGhbx5Irhz3ixdJMIBy QTQ7RH+a+VFSx4EPU7en7wqjV/Nzu32N4iBU/1ppB05xPuDu2mw3oo11ITUjPMddj1ry zB3EYiqBa2uPsTheoJ7eLKZZEIX0i6agkZFow6IO/iImoYSNl3NbaKfe/sTV233TgFbv guxw== 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=GtVUEn3BY9ydXbbvP4nuQEJw+ufHNgpJcSWPzbkbCVc=; b=DUlySpY/jF1J936Jx5+ljBiGIS5U4bP8vI/PB2MBtF1nAzLQTE7cY1LNKKRjUiY19P DI0VCaRyZqRDEVhvsIjvsBoDZtJgQ2wLo9ELvEKZVhUwXPNU5aVDcO+CSAUW9nE7TKZt C8dtleOAiur/wveLYIVrumnIcwYsykNYwan/Ul3G1ftOqlb+xyWxddeMXm3S232I18VT 2ixShkAyFw9KxWBi8PFbSV+LV/ZNZ8nny6nx8XnsC/VP9yxuyoHLEjLLXT6MtEaQcERc KD1fT72pusEJ4S4+WS/bvapZZxur0rMCuwM+/CbcKZy4szEoEfbtYFIIKGPi2VsV13qn jMOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="eat9G/Jt"; 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 l20-20020a056402255400b00445e7820127si2010597edb.381.2022.08.23.02.50.08; Tue, 23 Aug 2022 02:50:34 -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="eat9G/Jt"; 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 S242601AbiHWISL (ORCPT + 99 others); Tue, 23 Aug 2022 04:18:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60262 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242140AbiHWIMf (ORCPT ); Tue, 23 Aug 2022 04:12:35 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 142B46BD73; Tue, 23 Aug 2022 01:09:04 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 187026123D; Tue, 23 Aug 2022 08:09:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 12749C433D6; Tue, 23 Aug 2022 08:09:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242143; bh=t5e8m7zUSZLlKDZ0aO+vYJnddTUtFWDaqH96W3GXM0M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eat9G/JtCA4ktfCfn9LAwxsk6mrPrNXfU1h/KGWhpek/NgXlDKTPr819ephEvkTyg vVe/XpITKuzrj1hN1BxuUeEmmxoyy29rtsd2yZN3LCuihYzyfYzmxh60V3LlL4oG58 nMTV/xRDKJUDtv+3+gL/O0QEZkZ/q/GLNmeCC62c= 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 5.19 040/365] can: ems_usb: fix clangs -Wunaligned-access warning Date: Tue, 23 Aug 2022 09:59:01 +0200 Message-Id: <20220823080119.870866102@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@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 @@ -194,7 +194,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;