Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2145050iof; Tue, 7 Jun 2022 21:15:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz7wKq/tJ4T5FJfjVnX9ub74EFl/6FnUueOgLIkUdteiIZ5hzCxWujkYcQhngBWlykSuaqv X-Received: by 2002:a05:6a00:23ce:b0:50d:823f:981 with SMTP id g14-20020a056a0023ce00b0050d823f0981mr32981622pfc.10.1654661708071; Tue, 07 Jun 2022 21:15:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654661708; cv=none; d=google.com; s=arc-20160816; b=F+Z/wV6WoEEgQw5erUz78/ufwCUbSukfL9i5ces/zD1Nrc/fY6HVw1LoqsZlW/bOBy epzZXmUKy3UFMI2aa2HAtlF/XYoz9+K7I7gTLqf7anjcSNAnnFMJtxuSK1ia+bba38ag taZQynTI5Ck1vk2oAC/JJryu62prwNBuAfIQ6GMGveBr7Q3D9hdSUKUQkjD/u5VyTk2k JXmN9rqa7pZGYuTAjNR+x6wzZz2M2Ehfj+cIrqkfRzC0T5uVND9qpaj4okbHrezPAYI4 9W0f3pPZ/iEV4X0adYcgSQMeHdsBTR6RD/hUTuu0QPn5CYE/yJaH13ggb0LfgIGtRULY js3A== 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=BoA6FOnR+PM4iofjE9aXSPSQlqwL6yvpkg1yxL/zOyg=; b=fZEBglrqe/hW6ZJQkdU9sS0omUWKJsq0cQNV6gxdau5BioykekLx1GCeFFA+br7CCI ypvbDQeNHD5KtQfsQN8iqAyOz6Ftb9wDiN/3x9vnFDrIcOxgJmz/GTmTDWawRPK0Yher AFoDkqFyjAd8H3du6vZg32uZTXK8P6hCPjXsSjOTHJX6T5XgSMMCjquxbdysqwMcrYgK w5gGr7oy7VjemSQQbRletjjcWp3fyqFQot7T/QfzVgSN2papDrM0lDi2JA5b70HlFzuI 3IClp20nYSqDLp1hviPccR4YUrMR3r9UN39Lq9gnHS8eQTw9YBn2c9gloR+GAENOFJYO nB9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=YcIOiwzR; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id y24-20020a63e258000000b003fbc1919bb8si28620711pgj.539.2022.06.07.21.15.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 21:15:08 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=YcIOiwzR; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 968972EC2C7; Tue, 7 Jun 2022 20:47:55 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1381363AbiFGWTm (ORCPT + 99 others); Tue, 7 Jun 2022 18:19:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50688 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379858AbiFGVN5 (ORCPT ); Tue, 7 Jun 2022 17:13:57 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5059821AC59; Tue, 7 Jun 2022 11:54:32 -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 ams.source.kernel.org (Postfix) with ESMTPS id 93BA2B8239E; Tue, 7 Jun 2022 18:54:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BC428C36B0F; Tue, 7 Jun 2022 18:54:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628069; bh=8gQNAltN6BIULDhgTdmaQHw+k3XtzpJbkUP7TqeHUWw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YcIOiwzRj7woc6EZxFIe7MzNnsJCaKNkiz1qej11JpfPXbuFUJdDhFGRZVbSGcf1R xS8ufHYJoUbKjshu8nxuINkpHWVqdfQ/uYt44LFv+Gr4mYFpv15fVoiZ7dm1Uw4vob xGHth16cDxpuz3pn7RH98yD8MgYKdqQnGD2UwPTw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vincent Mailhol , kernel test robot , Marc Kleine-Budde , Sasha Levin , Nathan Chancellor Subject: [PATCH 5.18 193/879] can: mcp251xfd: silence clangs -Wunaligned-access warning Date: Tue, 7 Jun 2022 18:55:11 +0200 Message-Id: <20220607165008.444219311@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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: Vincent Mailhol [ Upstream commit 1a6dd9996699889313327be03981716a8337656b ] clang emits a -Wunaligned-access warning on union mcp251xfd_tx_ojb_load_buf. The reason is that field hw_tx_obj (not declared as packed) is being packed right after a 16 bits field inside a packed struct: | union mcp251xfd_tx_obj_load_buf { | struct __packed { | struct mcp251xfd_buf_cmd cmd; | /* ^ 16 bits fields */ | struct mcp251xfd_hw_tx_obj_raw hw_tx_obj; | /* ^ not declared as packed */ | } nocrc; | struct __packed { | struct mcp251xfd_buf_cmd_crc cmd; | struct mcp251xfd_hw_tx_obj_raw hw_tx_obj; | __be16 crc; | } crc; | } ____cacheline_aligned; Starting from LLVM 14, having an unpacked struct nested in a packed struct triggers a warning. c.f. [1]. This is a false positive because the field is always being accessed with the relevant put_unaligned_*() function. Adding __packed to the structure declaration silences the warning. [1] https://github.com/llvm/llvm-project/issues/55520 Link: https://lore.kernel.org/all/20220518114357.55452-1-mailhol.vincent@wanadoo.fr Signed-off-by: Vincent Mailhol Reported-by: kernel test robot Tested-by: Nathan Chancellor # build Signed-off-by: Marc Kleine-Budde Signed-off-by: Sasha Levin --- drivers/net/can/spi/mcp251xfd/mcp251xfd.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/can/spi/mcp251xfd/mcp251xfd.h b/drivers/net/can/spi/mcp251xfd/mcp251xfd.h index 9cb6b5ad8dda..60e56fa4601d 100644 --- a/drivers/net/can/spi/mcp251xfd/mcp251xfd.h +++ b/drivers/net/can/spi/mcp251xfd/mcp251xfd.h @@ -441,7 +441,7 @@ struct mcp251xfd_hw_tef_obj { /* The tx_obj_raw version is used in spi async, i.e. without * regmap. We have to take care of endianness ourselves. */ -struct mcp251xfd_hw_tx_obj_raw { +struct __packed mcp251xfd_hw_tx_obj_raw { __le32 id; __le32 flags; u8 data[sizeof_field(struct canfd_frame, data)]; -- 2.35.1