[linux-next:master 10145/13846] drivers/net/wireless/mediatek/mt76/mt7925/nan.c:210 mt7925_nan_mp_tlv() warn: impossible condition '(master_pref > 255) => (0-255 > 255)'

kernel test robot <[email protected]>
Newsgroups dev.linux.lists.oe-kbuild
Message-ID <[email protected]>
BCC: [email protected]
CC: [email protected]
TO: Sean Wang <[email protected]>
CC: Felix Fietkau <[email protected]>
CC: Stella Liu <[email protected]>
CC: Jeremy Yu <[email protected]>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   6b8c8af514d739d0335f5579b585e02babe8a727
commit: a5487a6824068cba6fab02f3e5186940a59275ed [10145/13846] wifi: mt76: mt7925: add NAN MCU helpers
:::::: branch date: 3 days ago
:::::: commit date: 10 days ago
config: x86_64-randconfig-161-20260810 (https://download.01.org/0day-ci/archive/20260810/[email protected]/config)
compiler: clang version 22.1.3 (https://github.com/llvm/llvm-project e9846648fd6183ee6d8cbdb4502213fcf902a211)
smatch: v0.5.0-9187-g5189e3fb

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Reported-by: Dan Carpenter <[email protected]>
| Closes: https://lore.kernel.org/r/[email protected]/

smatch warnings:
drivers/net/wireless/mediatek/mt76/mt7925/nan.c:210 mt7925_nan_mp_tlv() warn: impossible condition '(master_pref > 255) => (0-255 > 255)'

vim +210 drivers/net/wireless/mediatek/mt76/mt7925/nan.c

a5487a6824068cb Sean Wang 2026-06-24  193  
a5487a6824068cb Sean Wang 2026-06-24  194  static int
a5487a6824068cb Sean Wang 2026-06-24  195  mt7925_nan_mp_tlv(struct sk_buff *skb, u8 master_pref)
a5487a6824068cb Sean Wang 2026-06-24  196  {
a5487a6824068cb Sean Wang 2026-06-24  197  	struct mt7925_nan_master_preference_tlv *mp_tlv = NULL;
a5487a6824068cb Sean Wang 2026-06-24  198  	struct tlv *tlv = NULL;
a5487a6824068cb Sean Wang 2026-06-24  199  
a5487a6824068cb Sean Wang 2026-06-24  200  	if (!skb)
a5487a6824068cb Sean Wang 2026-06-24  201  		return -EINVAL;
a5487a6824068cb Sean Wang 2026-06-24  202  
a5487a6824068cb Sean Wang 2026-06-24  203  	tlv = mt76_connac_mcu_add_tlv(skb, NAN_UNI_CMD_SET_MASTER_PREFERENCE,
a5487a6824068cb Sean Wang 2026-06-24  204  				      sizeof(struct mt7925_nan_master_preference_tlv));
a5487a6824068cb Sean Wang 2026-06-24  205  	if (!tlv)
a5487a6824068cb Sean Wang 2026-06-24  206  		return -ENOMEM;
a5487a6824068cb Sean Wang 2026-06-24  207  
a5487a6824068cb Sean Wang 2026-06-24  208  	mp_tlv = (struct mt7925_nan_master_preference_tlv *)tlv;
a5487a6824068cb Sean Wang 2026-06-24  209  
a5487a6824068cb Sean Wang 2026-06-24 @210  	if (master_pref > NAN_MAX_MASTER_PREFERENCE)
a5487a6824068cb Sean Wang 2026-06-24  211  		return 0;
a5487a6824068cb Sean Wang 2026-06-24  212  
a5487a6824068cb Sean Wang 2026-06-24  213  	mp_tlv->master_preference = master_pref;
a5487a6824068cb Sean Wang 2026-06-24  214  
a5487a6824068cb Sean Wang 2026-06-24  215  	return 0;
a5487a6824068cb Sean Wang 2026-06-24  216  }
a5487a6824068cb Sean Wang 2026-06-24  217  

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.