[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202107190524.4BUYwVsj-lkp@intel.com>
Date: Mon, 19 Jul 2021 05:41:27 +0800
From: kernel test robot <lkp@...el.com>
To: Shayne Chen <shayne.chen@...iatek.com>
Cc: clang-built-linux@...glegroups.com, kbuild-all@...ts.01.org,
linux-kernel@...r.kernel.org, Felix Fietkau <nbd@....name>,
Bo Jiao <bo.jiao@...iatek.com>
Subject: [nbd168-wireless:mt76 10/26]
drivers/net/wireless/mediatek/mt76/mt7915/mcu.c:3407:22: warning: use of
logical '&&' with constant operand
tree: https://github.com/nbd168/wireless mt76
head: 322ec254cac2f270cd917c5e6bdf8c838ee0a2fc
commit: bb99c31e5dd3c90300c540541d727d956862e30b [10/26] mt76: mt7915: fix potential overflow of eeprom page index
config: mips-randconfig-r032-20210718 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 5d5b08761f944d5b9822d582378333cc4b36a0a7)
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://github.com/nbd168/wireless/commit/bb99c31e5dd3c90300c540541d727d956862e30b
git remote add nbd168-wireless https://github.com/nbd168/wireless
git fetch --no-tags nbd168-wireless mt76
git checkout bb99c31e5dd3c90300c540541d727d956862e30b
# 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@...el.com>
All warnings (new ones prefixed by >>):
drivers/net/wireless/mediatek/mt76/mt7915/mcu.c:114:10: warning: implicit conversion from enumeration type 'enum mt76_cipher_type' to different enumeration type 'enum mcu_cipher_type' [-Wenum-conversion]
return MT_CIPHER_NONE;
~~~~~~ ^~~~~~~~~~~~~~
>> drivers/net/wireless/mediatek/mt76/mt7915/mcu.c:3407:22: warning: use of logical '&&' with constant operand [-Wconstant-logical-operand]
if (i == total - 1 && MT7915_EEPROM_SIZE % PER_PAGE_SIZE)
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/wireless/mediatek/mt76/mt7915/mcu.c:3407:22: note: use '&' for a bitwise operation
if (i == total - 1 && MT7915_EEPROM_SIZE % PER_PAGE_SIZE)
^~
&
drivers/net/wireless/mediatek/mt76/mt7915/mcu.c:3407:22: note: remove constant to silence this warning
if (i == total - 1 && MT7915_EEPROM_SIZE % PER_PAGE_SIZE)
~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2 warnings generated.
vim +3407 drivers/net/wireless/mediatek/mt76/mt7915/mcu.c
3391
3392 static int mt7915_mcu_set_eeprom_flash(struct mt7915_dev *dev)
3393 {
3394 #define MAX_PAGE_IDX_MASK GENMASK(7, 5)
3395 #define PAGE_IDX_MASK GENMASK(4, 2)
3396 #define PER_PAGE_SIZE 0x400
3397 struct mt7915_mcu_eeprom req = { .buffer_mode = EE_MODE_BUFFER };
3398 u8 total = DIV_ROUND_UP(MT7915_EEPROM_SIZE, PER_PAGE_SIZE);
3399 u8 *eep = (u8 *)dev->mt76.eeprom.data;
3400 int eep_len;
3401 int i;
3402
3403 for (i = 0; i < total; i++, eep += eep_len) {
3404 struct sk_buff *skb;
3405 int ret;
3406
> 3407 if (i == total - 1 && MT7915_EEPROM_SIZE % PER_PAGE_SIZE)
3408 eep_len = MT7915_EEPROM_SIZE % PER_PAGE_SIZE;
3409 else
3410 eep_len = PER_PAGE_SIZE;
3411
3412 skb = mt76_mcu_msg_alloc(&dev->mt76, NULL,
3413 sizeof(req) + eep_len);
3414 if (!skb)
3415 return -ENOMEM;
3416
3417 req.format = FIELD_PREP(MAX_PAGE_IDX_MASK, total - 1) |
3418 FIELD_PREP(PAGE_IDX_MASK, i) | EE_FORMAT_WHOLE;
3419 req.len = cpu_to_le16(eep_len);
3420
3421 skb_put_data(skb, &req, sizeof(req));
3422 skb_put_data(skb, eep, eep_len);
3423
3424 ret = mt76_mcu_skb_send_msg(&dev->mt76, skb,
3425 MCU_EXT_CMD(EFUSE_BUFFER_MODE), true);
3426 if (ret)
3427 return ret;
3428 }
3429
3430 return 0;
3431 }
3432
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Download attachment ".config.gz" of type "application/gzip" (37606 bytes)
Powered by blists - more mailing lists