drivers/net/wireless/ath/ath11k/wmi.c:167:8: warning: format specifies type 'unsigned char' but the argument has type 'u16' (aka 'unsigned short')

From: kernel test robot
Date: Sun Nov 07 2021 - 08:04:12 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: b5013d084e03e82ceeab4db8ae8ceeaebe76b0eb
commit: 322b60ceb0f321b4b9c41717f7306c0dbaf0279b ath11k: do not depend on ARCH_QCOM for ath11k
date: 1 year, 3 months ago
config: x86_64-randconfig-a015-20210929 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project dc6e8dfdfe7efecfda318d43a06fae18b40eb498)
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
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=322b60ceb0f321b4b9c41717f7306c0dbaf0279b
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 322b60ceb0f321b4b9c41717f7306c0dbaf0279b
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=x86_64

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

All warnings (new ones prefixed by >>):

>> drivers/net/wireless/ath/ath11k/wmi.c:167:8: warning: format specifies type 'unsigned char' but the argument has type 'u16' (aka 'unsigned short') [-Wformat]
tlv_tag, ptr - begin, len, tlv_len);
^~~~~~~
drivers/net/wireless/ath/ath11k/wmi.c:167:35: warning: format specifies type 'unsigned char' but the argument has type 'u16' (aka 'unsigned short') [-Wformat]
tlv_tag, ptr - begin, len, tlv_len);
^~~~~~~
drivers/net/wireless/ath/ath11k/wmi.c:175:8: warning: format specifies type 'unsigned char' but the argument has type 'u16' (aka 'unsigned short') [-Wformat]
tlv_tag, ptr - begin, tlv_len,
^~~~~~~
drivers/net/wireless/ath/ath11k/wmi.c:175:30: warning: format specifies type 'unsigned char' but the argument has type 'u16' (aka 'unsigned short') [-Wformat]
tlv_tag, ptr - begin, tlv_len,
^~~~~~~
4 warnings generated.
--
>> drivers/net/wireless/ath/ath11k/mac.c:4617:22: warning: parameter 'changed_flags' set but not used [-Wunused-but-set-parameter]
unsigned int changed_flags,
^
>> drivers/net/wireless/ath/ath11k/mac.c:4714:6: warning: format specifies type 'unsigned short' but the argument has type 'u32' (aka 'unsigned int') [-Wformat]
ctx->def.chan->center_freq, ctx->def.width, ctx);
^~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/wireless/ath/ath11k/debug.h:303:37: note: expanded from macro 'ath11k_dbg'
__ath11k_dbg(ar, dbg_mask, fmt, ##__VA_ARGS__); \
~~~ ^~~~~~~~~~~
drivers/net/wireless/ath/ath11k/mac.c:4738:6: warning: format specifies type 'unsigned short' but the argument has type 'u32' (aka 'unsigned int') [-Wformat]
ctx->def.chan->center_freq, ctx->def.width, ctx);
^~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/wireless/ath/ath11k/debug.h:303:37: note: expanded from macro 'ath11k_dbg'
__ath11k_dbg(ar, dbg_mask, fmt, ##__VA_ARGS__); \
~~~ ^~~~~~~~~~~
drivers/net/wireless/ath/ath11k/mac.c:4994:7: warning: format specifies type 'unsigned short' but the argument has type 'u32' (aka 'unsigned int') [-Wformat]
vifs[i].old_ctx->def.chan->center_freq,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/wireless/ath/ath11k/debug.h:303:37: note: expanded from macro 'ath11k_dbg'
__ath11k_dbg(ar, dbg_mask, fmt, ##__VA_ARGS__); \
~~~ ^~~~~~~~~~~
drivers/net/wireless/ath/ath11k/mac.c:4995:7: warning: format specifies type 'unsigned short' but the argument has type 'u32' (aka 'unsigned int') [-Wformat]
vifs[i].new_ctx->def.chan->center_freq,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/wireless/ath/ath11k/debug.h:303:37: note: expanded from macro 'ath11k_dbg'
__ath11k_dbg(ar, dbg_mask, fmt, ##__VA_ARGS__); \
~~~ ^~~~~~~~~~~
drivers/net/wireless/ath/ath11k/mac.c:5090:6: warning: format specifies type 'unsigned short' but the argument has type 'u32' (aka 'unsigned int') [-Wformat]
ctx->def.chan->center_freq, ctx->def.width, ctx, changed);
^~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/wireless/ath/ath11k/debug.h:303:37: note: expanded from macro 'ath11k_dbg'
__ath11k_dbg(ar, dbg_mask, fmt, ##__VA_ARGS__); \
~~~ ^~~~~~~~~~~
>> drivers/net/wireless/ath/ath11k/mac.c:5393:22: warning: format specifies type 'unsigned char' but the argument has type 'u32' (aka 'unsigned int') [-Wformat]
arvif->vdev_id, rate, nss, sgi);
^~~~
drivers/net/wireless/ath/ath11k/debug.h:303:37: note: expanded from macro 'ath11k_dbg'
__ath11k_dbg(ar, dbg_mask, fmt, ##__VA_ARGS__); \
~~~ ^~~~~~~~~~~
7 warnings generated.
--
>> drivers/net/wireless/ath/ath11k/dp_rx.c:1200:8: warning: format specifies type 'unsigned char' but the argument has type 'u16' (aka 'unsigned short') [-Wformat]
tlv_tag, ptr - begin, len, tlv_len);
^~~~~~~
drivers/net/wireless/ath/ath11k/dp_rx.c:1200:35: warning: format specifies type 'unsigned char' but the argument has type 'u16' (aka 'unsigned short') [-Wformat]
tlv_tag, ptr - begin, len, tlv_len);
^~~~~~~
2 warnings generated.


vim +167 drivers/net/wireless/ath/ath11k/wmi.c

d5c65159f28953 Kalle Valo 2019-11-23 140
d5c65159f28953 Kalle Valo 2019-11-23 141 static int
d5c65159f28953 Kalle Valo 2019-11-23 142 ath11k_wmi_tlv_iter(struct ath11k_base *ab, const void *ptr, size_t len,
d5c65159f28953 Kalle Valo 2019-11-23 143 int (*iter)(struct ath11k_base *ab, u16 tag, u16 len,
d5c65159f28953 Kalle Valo 2019-11-23 144 const void *ptr, void *data),
d5c65159f28953 Kalle Valo 2019-11-23 145 void *data)
d5c65159f28953 Kalle Valo 2019-11-23 146 {
d5c65159f28953 Kalle Valo 2019-11-23 147 const void *begin = ptr;
d5c65159f28953 Kalle Valo 2019-11-23 148 const struct wmi_tlv *tlv;
d5c65159f28953 Kalle Valo 2019-11-23 149 u16 tlv_tag, tlv_len;
d5c65159f28953 Kalle Valo 2019-11-23 150 int ret;
d5c65159f28953 Kalle Valo 2019-11-23 151
d5c65159f28953 Kalle Valo 2019-11-23 152 while (len > 0) {
d5c65159f28953 Kalle Valo 2019-11-23 153 if (len < sizeof(*tlv)) {
d5c65159f28953 Kalle Valo 2019-11-23 154 ath11k_err(ab, "wmi tlv parse failure at byte %zd (%zu bytes left, %zu expected)\n",
d5c65159f28953 Kalle Valo 2019-11-23 155 ptr - begin, len, sizeof(*tlv));
d5c65159f28953 Kalle Valo 2019-11-23 156 return -EINVAL;
d5c65159f28953 Kalle Valo 2019-11-23 157 }
d5c65159f28953 Kalle Valo 2019-11-23 158
d5c65159f28953 Kalle Valo 2019-11-23 159 tlv = ptr;
d5c65159f28953 Kalle Valo 2019-11-23 160 tlv_tag = FIELD_GET(WMI_TLV_TAG, tlv->header);
d5c65159f28953 Kalle Valo 2019-11-23 161 tlv_len = FIELD_GET(WMI_TLV_LEN, tlv->header);
d5c65159f28953 Kalle Valo 2019-11-23 162 ptr += sizeof(*tlv);
d5c65159f28953 Kalle Valo 2019-11-23 163 len -= sizeof(*tlv);
d5c65159f28953 Kalle Valo 2019-11-23 164
d5c65159f28953 Kalle Valo 2019-11-23 165 if (tlv_len > len) {
d5c65159f28953 Kalle Valo 2019-11-23 166 ath11k_err(ab, "wmi tlv parse failure of tag %hhu at byte %zd (%zu bytes left, %hhu expected)\n",
d5c65159f28953 Kalle Valo 2019-11-23 @167 tlv_tag, ptr - begin, len, tlv_len);
d5c65159f28953 Kalle Valo 2019-11-23 168 return -EINVAL;
d5c65159f28953 Kalle Valo 2019-11-23 169 }
d5c65159f28953 Kalle Valo 2019-11-23 170
d5c65159f28953 Kalle Valo 2019-11-23 171 if (tlv_tag < ARRAY_SIZE(wmi_tlv_policies) &&
d5c65159f28953 Kalle Valo 2019-11-23 172 wmi_tlv_policies[tlv_tag].min_len &&
d5c65159f28953 Kalle Valo 2019-11-23 173 wmi_tlv_policies[tlv_tag].min_len > tlv_len) {
d5c65159f28953 Kalle Valo 2019-11-23 174 ath11k_err(ab, "wmi tlv parse failure of tag %hhu at byte %zd (%hhu bytes is less than min length %zu)\n",
d5c65159f28953 Kalle Valo 2019-11-23 175 tlv_tag, ptr - begin, tlv_len,
d5c65159f28953 Kalle Valo 2019-11-23 176 wmi_tlv_policies[tlv_tag].min_len);
d5c65159f28953 Kalle Valo 2019-11-23 177 return -EINVAL;
d5c65159f28953 Kalle Valo 2019-11-23 178 }
d5c65159f28953 Kalle Valo 2019-11-23 179
d5c65159f28953 Kalle Valo 2019-11-23 180 ret = iter(ab, tlv_tag, tlv_len, ptr, data);
d5c65159f28953 Kalle Valo 2019-11-23 181 if (ret)
d5c65159f28953 Kalle Valo 2019-11-23 182 return ret;
d5c65159f28953 Kalle Valo 2019-11-23 183
d5c65159f28953 Kalle Valo 2019-11-23 184 ptr += tlv_len;
d5c65159f28953 Kalle Valo 2019-11-23 185 len -= tlv_len;
d5c65159f28953 Kalle Valo 2019-11-23 186 }
d5c65159f28953 Kalle Valo 2019-11-23 187
d5c65159f28953 Kalle Valo 2019-11-23 188 return 0;
d5c65159f28953 Kalle Valo 2019-11-23 189 }
d5c65159f28953 Kalle Valo 2019-11-23 190

:::::: The code at line 167 was first introduced by commit
:::::: d5c65159f2895379e11ca13f62feabe93278985d ath11k: driver for Qualcomm IEEE 802.11ax devices

:::::: TO: Kalle Valo <kvalo@xxxxxxxxxxxxxx>
:::::: CC: Kalle Valo <kvalo@xxxxxxxxxxxxxx>

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

Attachment: .config.gz
Description: application/gzip