Message ID | 20230616090343.2454061-1-arnd@kernel.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp1196645vqr; Fri, 16 Jun 2023 02:28:56 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6suLpshl4+WXM2IRpnvCOLgQTpwTf//5EYGRMsfc355PAL/1I/MYGv7VvpcUCU+WNyveH8 X-Received: by 2002:a17:903:228d:b0:1b5:f0:ccc6 with SMTP id b13-20020a170903228d00b001b500f0ccc6mr1466065plh.17.1686907735929; Fri, 16 Jun 2023 02:28:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686907735; cv=none; d=google.com; s=arc-20160816; b=ihgYxTCex6tsDkffiFRjuD08UZ0iGV0Y3edUect4oszCofC4hhv9SXCDLpTSQfgDmB Oc1IO5Wd4SMlxeh4zi0eoQtCuWNAx7BnTYL//7gjpk0JBJcsgCI0S9INEOWExfAMsSIF 87tpwkO6YQCTPauGEd1VDvvXnuvYUQt7hppsqI97F0VbhG+NRhQkzpaTO9RdEapb+HsA jfMPmzPiPqslU8BxU0GakGAHSApK7menwxi/kJOlqSDD6hYV6w2AoeXTNnoxRrw0Ki7R 9HWLPewHGKUzOSwf/rh5+qvfjdZHZ+IZfvwed766x1ilvRDhPA3dsblnvdmLHKjqkL/R GI0Q== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=FIiaNHbhKxtqKKxYSfjU/FTBjylsi286DwM81hsGLNo=; b=fkd5kKi0oqKaPQmwtXLAaIu4WECOOmDKBP8Q4l2IAuYhJ2S3bbhVhnK1UgWvLtaHPM fo3ATlIkNqUrq5/Utb7kolNjOBy2TqtAU5jBrUGt0V/6LNyadzbjQ85d6CctnnvQlA8L E1KBMSodH0sV4ixxanzVfK4lOy4u/6GRdLsLMR/B41VPWPyZBO8bl1A8ehEe0f/qRSf8 jItNkdjINnSV6FIsH+7dj0yDQnkaOeymodL5cXh4/9Tv1NU6Ote8WRPFWkJ19XWjL2Ey q4eQ7tzAR7BMCMkkJRb6iORmDJPavR1rM3cST83rWCL/QKrQ7n65hx60Zl4UD5GXfJlt ypCQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="p/288pR+"; 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=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a10-20020a170902ee8a00b001aaef930752si13686033pld.647.2023.06.16.02.28.40; Fri, 16 Jun 2023 02:28:55 -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=@kernel.org header.s=k20201202 header.b="p/288pR+"; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245404AbjFPJGV (ORCPT <rfc822;maxin.john@gmail.com> + 99 others); Fri, 16 Jun 2023 05:06:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53306 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343928AbjFPJGF (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 16 Jun 2023 05:06:05 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D71521BE3; Fri, 16 Jun 2023 02:03:49 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6E66260C5E; Fri, 16 Jun 2023 09:03:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9C6C5C433C0; Fri, 16 Jun 2023 09:03:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1686906228; bh=bhE+0A/OQIrRGA/14kkswPkAR/ndWpXFLbO2JGK/4v4=; h=From:To:Cc:Subject:Date:From; b=p/288pR+J8bm9d+aQU3rQISNwuWPc6m1kc94uuz63DfMzJEmOh+SjrWc80HC+m8FN VCRXCaB8VCpDeVOi6P9XFKaiNAcUEDug6NYRmDPHr/drHzNri9ogRAAOFRVwkbylac CG6P61TvyPw039Qb4j1beTWgM+c4f2ni4W+Fw7BDP3Ar/jqcElLF88kWM7ewyKc85E fQeM1WlCJhtjcyFkLB1XklJIjJKtn8EkvkzT/iNQaDE0BrdjRhVc2uac1X7+q4MbRw QJpWVC9sSCz/cqbP8Z5sDFuqkpzTGpQzwlyrI7P4QqAgStRtMEEup1N4ysSzHjyS12 yS7W58uSSno7A== From: Arnd Bergmann <arnd@kernel.org> To: Gregory Greenman <gregory.greenman@intel.com>, Kalle Valo <kvalo@kernel.org>, Luca Coelho <luciano.coelho@intel.com>, Shahar S Matityahu <shahar.s.matityahu@intel.com> Cc: Arnd Bergmann <arnd@arndb.de>, Mukesh Sisodiya <mukesh.sisodiya@intel.com>, Johannes Berg <johannes.berg@intel.com>, linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] iwlwifi: dbg_ini: fix structure packing Date: Fri, 16 Jun 2023 11:03:34 +0200 Message-Id: <20230616090343.2454061-1-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768850966141715758?= X-GMAIL-MSGID: =?utf-8?q?1768850966141715758?= |
Series |
iwlwifi: dbg_ini: fix structure packing
|
|
Commit Message
Arnd Bergmann
June 16, 2023, 9:03 a.m. UTC
From: Arnd Bergmann <arnd@arndb.de> The iwl_fw_ini_error_dump_range structure has conflicting alignment requirements for the inner union and the outer struct: In file included from drivers/net/wireless/intel/iwlwifi/fw/dbg.c:9: drivers/net/wireless/intel/iwlwifi/fw/error-dump.h:312:2: error: field within 'struct iwl_fw_ini_error_dump_range' is less aligned than 'union iwl_fw_ini_error_dump_range::(anonymous at drivers/net/wireless/intel/iwlwifi/fw/error-dump.h:312:2)' and is usually due to 'struct iwl_fw_ini_error_dump_range' being packed, which can lead to unaligned accesses [-Werror,-Wunaligned-access] union { As the original intention was apparently to make the entire structure unaligned, mark the innermost members the same way so the union becomes packed as well. Fixes: 973193554cae6 ("iwlwifi: dbg_ini: dump headers cleanup") Signed-off-by: Arnd Bergmann <arnd@arndb.de> --- drivers/net/wireless/intel/iwlwifi/fw/error-dump.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
Comments
On Mon, Aug 14, 2023, at 20:28, Johannes Berg wrote: > On Fri, 2023-06-16 at 11:03 +0200, Arnd Bergmann wrote: >> >> As the original intention was apparently to make the entire structure >> unaligned, mark the innermost members the same way so the union >> becomes packed as well. > > Hm. Not sure exactly what you mean by that, but shouldn't we make that > "union { ... } __packed"? Up to you, the effect is the same, as the other two members are already packed. I generally try to keep the packing to the members that are actually unaligned, to make the code more efficient, but in this case the entire structure is unaligned, so it doesn't matter. Arnd
diff --git a/drivers/net/wireless/intel/iwlwifi/fw/error-dump.h b/drivers/net/wireless/intel/iwlwifi/fw/error-dump.h index f5e08988dc7bf..06d6f7f664308 100644 --- a/drivers/net/wireless/intel/iwlwifi/fw/error-dump.h +++ b/drivers/net/wireless/intel/iwlwifi/fw/error-dump.h @@ -310,9 +310,9 @@ struct iwl_fw_ini_fifo_hdr { struct iwl_fw_ini_error_dump_range { __le32 range_data_size; union { - __le32 internal_base_addr; - __le64 dram_base_addr; - __le32 page_num; + __le32 internal_base_addr __packed; + __le64 dram_base_addr __packed; + __le32 page_num __packed; struct iwl_fw_ini_fifo_hdr fifo_hdr; struct iwl_cmd_header fw_pkt_hdr; };