drivers/net/wireless/intel/iwlwifi/mvm/phy-ctxt.c:183:37: warning: taking address of packed member 'rxchain_info' of class or structure 'iwl_phy_context_cmd_tail' may result in an unaligned pointer value

From: kernel test robot
Date: Mon Mar 01 2021 - 05:02:33 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: fe07bfda2fb9cdef8a4d4008a409bb02f35f1bd8
commit: a86821069e87755d8f0f98a9bc3e848098dd28e8 iwlwifi: phy-ctxt: add new API VER 3 for phy context cmd
date: 5 months ago
config: mips-randconfig-r011-20210301 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project b077d82b00d81934c7c27ac89dd8b0e7f448bded)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install mips cross compiling tool for clang build
# apt-get install binutils-mips-linux-gnu
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=a86821069e87755d8f0f98a9bc3e848098dd28e8
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout a86821069e87755d8f0f98a9bc3e848098dd28e8
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=mips

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>):

arch/mips/include/asm/sync.h:147:34: note: expanded from macro '__SYNC_loongson3_war'
# define __SYNC_loongson3_war (1 << 31)
^
In file included from drivers/net/wireless/intel/iwlwifi/mvm/phy-ctxt.c:64:
In file included from include/net/mac80211.h:18:
In file included from include/linux/if_ether.h:19:
In file included from include/linux/skbuff.h:28:
In file included from include/net/checksum.h:22:
arch/mips/include/asm/checksum.h:195:9: error: unsupported inline asm: input with type 'unsigned long' matching output with type '__wsum' (aka 'unsigned int')
: "0" ((__force unsigned long)daddr),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from drivers/net/wireless/intel/iwlwifi/mvm/phy-ctxt.c:64:
In file included from include/net/mac80211.h:18:
In file included from include/linux/if_ether.h:19:
In file included from include/linux/skbuff.h:31:
In file included from include/linux/dma-mapping.h:7:
In file included from include/linux/device.h:16:
In file included from include/linux/energy_model.h:10:
include/linux/sched/topology.h:254:9: error: implicit declaration of function 'cpu_logical_map' [-Werror,-Wimplicit-function-declaration]
return cpu_to_node(task_cpu(p));
^
arch/mips/include/asm/mach-loongson64/topology.h:7:27: note: expanded from macro 'cpu_to_node'
#define cpu_to_node(cpu) (cpu_logical_map(cpu) >> 2)
^
In file included from drivers/net/wireless/intel/iwlwifi/mvm/phy-ctxt.c:64:
In file included from include/net/mac80211.h:20:
In file included from include/linux/ieee80211.h:20:
In file included from include/linux/etherdevice.h:21:
include/linux/netdevice.h:554:11: warning: converting the result of '<<' to a boolean always evaluates to true [-Wtautological-constant-compare]
} while (cmpxchg(&n->state, val, new) != val);
^
arch/mips/include/asm/cmpxchg.h:194:7: note: expanded from macro 'cmpxchg'
if (!__SYNC_loongson3_war) \
^
arch/mips/include/asm/sync.h:147:34: note: expanded from macro '__SYNC_loongson3_war'
# define __SYNC_loongson3_war (1 << 31)
^
In file included from drivers/net/wireless/intel/iwlwifi/mvm/phy-ctxt.c:64:
In file included from include/net/mac80211.h:20:
In file included from include/linux/ieee80211.h:20:
In file included from include/linux/etherdevice.h:21:
include/linux/netdevice.h:554:11: warning: converting the result of '<<' to a boolean always evaluates to true [-Wtautological-constant-compare]
arch/mips/include/asm/cmpxchg.h:204:7: note: expanded from macro 'cmpxchg'
if (!__SYNC_loongson3_war) \
^
arch/mips/include/asm/sync.h:147:34: note: expanded from macro '__SYNC_loongson3_war'
# define __SYNC_loongson3_war (1 << 31)
^
In file included from drivers/net/wireless/intel/iwlwifi/mvm/phy-ctxt.c:64:
In file included from include/net/mac80211.h:22:
In file included from include/net/codel.h:48:
In file included from include/net/inet_ecn.h:9:
In file included from include/net/inet_sock.h:22:
In file included from include/net/sock.h:61:
include/linux/poll.h:142:27: warning: division by zero is undefined [-Wdivision-by-zero]
M(RDNORM) | M(RDBAND) | M(WRNORM) | M(WRBAND) |
^~~~~~~~~
include/linux/poll.h:140:32: note: expanded from macro 'M'
#define M(X) (__force __poll_t)__MAP(val, POLL##X, (__force __u16)EPOLL##X)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/poll.h:126:51: note: expanded from macro '__MAP'
(from < to ? (v & from) * (to/from) : (v & from) / (from/to))
^ ~~~~~~~~~
include/linux/poll.h:142:39: warning: division by zero is undefined [-Wdivision-by-zero]
M(RDNORM) | M(RDBAND) | M(WRNORM) | M(WRBAND) |
^~~~~~~~~
include/linux/poll.h:140:32: note: expanded from macro 'M'
#define M(X) (__force __poll_t)__MAP(val, POLL##X, (__force __u16)EPOLL##X)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/poll.h:126:51: note: expanded from macro '__MAP'
(from < to ? (v & from) * (to/from) : (v & from) / (from/to))
^ ~~~~~~~~~
In file included from drivers/net/wireless/intel/iwlwifi/mvm/phy-ctxt.c:64:
In file included from include/net/mac80211.h:22:
In file included from include/net/codel.h:48:
In file included from include/net/inet_ecn.h:9:
In file included from include/net/inet_sock.h:22:
include/net/sock.h:1969:12: warning: converting the result of '<<' to a boolean always evaluates to true [-Wtautological-constant-compare]
old_dst = xchg((__force struct dst_entry **)&sk->sk_dst_cache, dst);
^
arch/mips/include/asm/cmpxchg.h:102:7: note: expanded from macro 'xchg'
if (!__SYNC_loongson3_war) \
^
arch/mips/include/asm/sync.h:147:34: note: expanded from macro '__SYNC_loongson3_war'
# define __SYNC_loongson3_war (1 << 31)
^
In file included from drivers/net/wireless/intel/iwlwifi/mvm/phy-ctxt.c:64:
In file included from include/net/mac80211.h:22:
In file included from include/net/codel.h:48:
In file included from include/net/inet_ecn.h:9:
In file included from include/net/inet_sock.h:22:
include/net/sock.h:2219:8: warning: converting the result of '<<' to a boolean always evaluates to true [-Wtautological-constant-compare]
err = xchg(&sk->sk_err, 0);
^
arch/mips/include/asm/cmpxchg.h:102:7: note: expanded from macro 'xchg'
if (!__SYNC_loongson3_war) \
^
arch/mips/include/asm/sync.h:147:34: note: expanded from macro '__SYNC_loongson3_war'
# define __SYNC_loongson3_war (1 << 31)
^
>> drivers/net/wireless/intel/iwlwifi/mvm/phy-ctxt.c:183:37: warning: taking address of packed member 'rxchain_info' of class or structure 'iwl_phy_context_cmd_tail' may result in an unaligned pointer value [-Waddress-of-packed-member]
iwl_mvm_phy_ctxt_set_rxchain(mvm, &tail->rxchain_info,
^~~~~~~~~~~~~~~~~~
>> drivers/net/wireless/intel/iwlwifi/mvm/phy-ctxt.c:206:37: warning: taking address of packed member 'rxchain_info' of class or structure 'iwl_phy_context_cmd' may result in an unaligned pointer value [-Waddress-of-packed-member]
iwl_mvm_phy_ctxt_set_rxchain(mvm, &cmd->rxchain_info,
^~~~~~~~~~~~~~~~~
20 warnings and 5 errors generated.


vim +183 drivers/net/wireless/intel/iwlwifi/mvm/phy-ctxt.c

168
169 /*
170 * Add the phy configuration to the PHY context command
171 */
172 static void iwl_mvm_phy_ctxt_cmd_data_v1(struct iwl_mvm *mvm,
173 struct iwl_phy_context_cmd_v1 *cmd,
174 struct cfg80211_chan_def *chandef,
175 u8 chains_static, u8 chains_dynamic)
176 {
177 struct iwl_phy_context_cmd_tail *tail =
178 iwl_mvm_chan_info_cmd_tail(mvm, &cmd->ci);
179
180 /* Set the channel info data */
181 iwl_mvm_set_chan_info_chandef(mvm, &cmd->ci, chandef);
182
> 183 iwl_mvm_phy_ctxt_set_rxchain(mvm, &tail->rxchain_info,
184 chains_static, chains_dynamic);
185
186 tail->txchain_info = cpu_to_le32(iwl_mvm_get_valid_tx_ant(mvm));
187 }
188
189 /*
190 * Add the phy configuration to the PHY context command
191 */
192 static void iwl_mvm_phy_ctxt_cmd_data(struct iwl_mvm *mvm,
193 struct iwl_phy_context_cmd *cmd,
194 struct cfg80211_chan_def *chandef,
195 u8 chains_static, u8 chains_dynamic)
196 {
197 if (chandef->chan->band == NL80211_BAND_2GHZ ||
198 !iwl_mvm_is_cdb_supported(mvm))
199 cmd->lmac_id = cpu_to_le32(IWL_LMAC_24G_INDEX);
200 else
201 cmd->lmac_id = cpu_to_le32(IWL_LMAC_5G_INDEX);
202
203 /* Set the channel info data */
204 iwl_mvm_set_chan_info_chandef(mvm, &cmd->ci, chandef);
205
> 206 iwl_mvm_phy_ctxt_set_rxchain(mvm, &cmd->rxchain_info,
207 chains_static, chains_dynamic);
208 }
209

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip