drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c:262:17: warning: taking address of packed member 'len' of class or structure 'tlv' may result in an unaligned pointer value
From: kernel test robot
Date: Mon Jul 25 2022 - 07:01:05 EST
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: e0dccc3b76fb35bb257b4118367a883073d7390e
commit: 25702d9c55dc5fda2ad9ad8de115e50dc7394ef9 mt76: connac: rely on le16_add_cpu in mt76_connac_mcu_add_nested_tlv
date: 7 months ago
config: arm-buildonly-randconfig-r003-20220724 (https://download.01.org/0day-ci/archive/20220725/202207251801.hLXIP9Rh-lkp@xxxxxxxxx/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 9e88cbcc403bdf82f29259ad60ff60a8fc4434a1)
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 arm cross compiling tool for clang build
# apt-get install binutils-arm-linux-gnueabi
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=25702d9c55dc5fda2ad9ad8de115e50dc7394ef9
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 25702d9c55dc5fda2ad9ad8de115e50dc7394ef9
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=arm SHELL=/bin/bash drivers/net/wireless/mediatek/mt76/
If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@xxxxxxxxx>
All warnings (new ones prefixed by >>):
>> drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c:262:17: warning: taking address of packed member 'len' of class or structure 'tlv' may result in an unaligned pointer value [-Waddress-of-packed-member]
le16_add_cpu(&sta_hdr->len, len);
^~~~~~~~~~~~
1 warning generated.
vim +262 drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
242
243 struct tlv *
244 mt76_connac_mcu_add_nested_tlv(struct sk_buff *skb, int tag, int len,
245 void *sta_ntlv, void *sta_wtbl)
246 {
247 struct sta_ntlv_hdr *ntlv_hdr = sta_ntlv;
248 struct tlv *sta_hdr = sta_wtbl;
249 struct tlv *ptlv, tlv = {
250 .tag = cpu_to_le16(tag),
251 .len = cpu_to_le16(len),
252 };
253 u16 ntlv;
254
255 ptlv = skb_put(skb, len);
256 memcpy(ptlv, &tlv, sizeof(tlv));
257
258 ntlv = le16_to_cpu(ntlv_hdr->tlv_num);
259 ntlv_hdr->tlv_num = cpu_to_le16(ntlv + 1);
260
261 if (sta_hdr)
> 262 le16_add_cpu(&sta_hdr->len, len);
263
264 return ptlv;
265 }
266 EXPORT_SYMBOL_GPL(mt76_connac_mcu_add_nested_tlv);
267
--
0-DAY CI Kernel Test Service
https://01.org/lkp