All of lore.kernel.org
 help / color / mirror / Atom feed
* net/bluetooth/eir.c:212:2: warning: Value stored to 'ptr' is never read [clang-analyzer-deadcode.DeadStores]
@ 2021-11-25  2:25 kernel test robot
  0 siblings, 0 replies; 3+ messages in thread
From: kernel test robot @ 2021-11-25  2:25 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 20472 bytes --]

CC: llvm(a)lists.linux.dev
CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
CC: 0day robot <lkp@intel.com>

tree:   https://github.com/0day-ci/linux/commits/Luiz-Augusto-von-Dentz/Bluetooth-eir-Move-EIR-Adv-Data-functions-to-its-own-file/20210922-113507
head:   cda1eaab813d24fd5a24abcae5c22e15191ee466
commit: cda1eaab813d24fd5a24abcae5c22e15191ee466 Bluetooth: eir: Move EIR/Adv Data functions to its own file
date:   9 weeks ago
:::::: branch date: 9 weeks ago
:::::: commit date: 9 weeks ago
config: i386-randconfig-c001-20210927 (https://download.01.org/0day-ci/archive/20211125/202111251040.KnZ82wqt-lkp(a)intel.com/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://github.com/0day-ci/linux/commit/cda1eaab813d24fd5a24abcae5c22e15191ee466
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Luiz-Augusto-von-Dentz/Bluetooth-eir-Move-EIR-Adv-Data-functions-to-its-own-file/20210922-113507
        git checkout cda1eaab813d24fd5a24abcae5c22e15191ee466
        # save the config file to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=i386 clang-analyzer 

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


clang-analyzer warnings: (new ones prefixed by >>)
   13 warnings generated.
   Suppressed 13 warnings (13 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   14 warnings generated.
   Suppressed 14 warnings (14 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   13 warnings generated.
   Suppressed 13 warnings (13 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   13 warnings generated.
   Suppressed 13 warnings (13 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   13 warnings generated.
   Suppressed 13 warnings (13 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   13 warnings generated.
   Suppressed 13 warnings (13 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   13 warnings generated.
   Suppressed 13 warnings (13 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   13 warnings generated.
   Suppressed 13 warnings (13 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   12 warnings generated.
   Suppressed 12 warnings (12 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   13 warnings generated.
   Suppressed 13 warnings (13 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   13 warnings generated.
   Suppressed 13 warnings (13 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   13 warnings generated.
   Suppressed 13 warnings (13 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   13 warnings generated.
   Suppressed 13 warnings (13 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   15 warnings generated.
   net/mac80211/cfg.c:951:3: warning: Value stored to 'pos' is never read [clang-analyzer-deadcode.DeadStores]
                   pos += civicloc_len;
                   ^      ~~~~~~~~~~~~
   net/mac80211/cfg.c:951:3: note: Value stored to 'pos' is never read
                   pos += civicloc_len;
                   ^      ~~~~~~~~~~~~
   net/mac80211/cfg.c:3144:3: warning: Value stored to 'pos' is never read [clang-analyzer-deadcode.DeadStores]
                   pos += beacon->civicloc_len;
                   ^      ~~~~~~~~~~~~~~~~~~~~
   net/mac80211/cfg.c:3144:3: note: Value stored to 'pos' is never read
                   pos += beacon->civicloc_len;
                   ^      ~~~~~~~~~~~~~~~~~~~~
   Suppressed 13 warnings (13 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   16 warnings generated.
   drivers/net/ethernet/intel/i40e/i40e_debugfs.c:1041:5: warning: Value stored to 'ret' is never read [clang-analyzer-deadcode.DeadStores]
                                   ret = -ENOMEM;
                                   ^     ~~~~~~~
   drivers/net/ethernet/intel/i40e/i40e_debugfs.c:1041:5: note: Value stored to 'ret' is never read
                                   ret = -ENOMEM;
                                   ^     ~~~~~~~
   Suppressed 15 warnings (15 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   13 warnings generated.
   Suppressed 13 warnings (13 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   18 warnings generated.
   drivers/net/ethernet/intel/i40e/i40e_txrx.c:2971:3: warning: Value stored to 'protocol' is never read [clang-analyzer-deadcode.DeadStores]
                   protocol = vhdr->h_vlan_encapsulated_proto;
                   ^          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/i40e/i40e_txrx.c:2971:3: note: Value stored to 'protocol' is never read
                   protocol = vhdr->h_vlan_encapsulated_proto;
                   ^          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/i40e/i40e_txrx.c:3507:2: warning: Value stored to 'tx_bi' is never read [clang-analyzer-deadcode.DeadStores]
           tx_bi = first;
           ^       ~~~~~
   drivers/net/ethernet/intel/i40e/i40e_txrx.c:3507:2: note: Value stored to 'tx_bi' is never read
           tx_bi = first;
           ^       ~~~~~
   drivers/net/ethernet/intel/i40e/i40e_txrx.c:3565:3: warning: Value stored to 'tx_bi' is never read [clang-analyzer-deadcode.DeadStores]
                   tx_bi = &tx_ring->tx_bi[i];
                   ^       ~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/i40e/i40e_txrx.c:3565:3: note: Value stored to 'tx_bi' is never read
                   tx_bi = &tx_ring->tx_bi[i];
                   ^       ~~~~~~~~~~~~~~~~~~
   Suppressed 15 warnings (15 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   15 warnings generated.
   Suppressed 15 warnings (15 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   14 warnings generated.
   Suppressed 14 warnings (14 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   14 warnings generated.
   Suppressed 14 warnings (14 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   14 warnings generated.
   Suppressed 14 warnings (14 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   16 warnings generated.
>> net/bluetooth/eir.c:212:2: warning: Value stored to 'ptr' is never read [clang-analyzer-deadcode.DeadStores]
           ptr = create_uuid128_list(hdev, ptr, HCI_MAX_EIR_LENGTH - (ptr - data));
           ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/bluetooth/eir.c:212:2: note: Value stored to 'ptr' is never read
           ptr = create_uuid128_list(hdev, ptr, HCI_MAX_EIR_LENGTH - (ptr - data));
           ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/bluetooth/eir.c:295:4: warning: Value stored to 'ptr' is never read [clang-analyzer-deadcode.DeadStores]
                           ptr += 3;
                           ^      ~
   net/bluetooth/eir.c:295:4: note: Value stored to 'ptr' is never read
                           ptr += 3;
                           ^      ~
   Suppressed 14 warnings (14 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   13 warnings generated.
   Suppressed 13 warnings (13 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   12 warnings generated.
   Suppressed 12 warnings (12 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   12 warnings generated.
   Suppressed 12 warnings (12 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   12 warnings generated.
   Suppressed 12 warnings (12 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   12 warnings generated.
   Suppressed 12 warnings (12 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   12 warnings generated.
   Suppressed 12 warnings (12 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   12 warnings generated.
   Suppressed 12 warnings (12 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   12 warnings generated.
   Suppressed 12 warnings (12 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   12 warnings generated.
   Suppressed 12 warnings (12 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   12 warnings generated.
   Suppressed 12 warnings (12 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   12 warnings generated.
   Suppressed 12 warnings (12 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   12 warnings generated.
   Suppressed 12 warnings (12 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   13 warnings generated.
   Suppressed 13 warnings (13 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   13 warnings generated.
   Suppressed 13 warnings (13 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   15 warnings generated.
   net/bluetooth/hci_core.c:2192:2: warning: Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119 [clang-analyzer-security.insecureAPI.strcpy]
           strcpy(di.name, hdev->name);
           ^~~~~~
   net/bluetooth/hci_core.c:2192:2: note: Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119
           strcpy(di.name, hdev->name);
           ^~~~~~
   Suppressed 14 warnings (14 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   14 warnings generated.
   Suppressed 14 warnings (14 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   7 warnings generated.
   Suppressed 7 warnings (7 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   7 warnings generated.
   Suppressed 7 warnings (7 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   13 warnings generated.
   Suppressed 13 warnings (13 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   13 warnings generated.
   Suppressed 13 warnings (13 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   12 warnings generated.
   Suppressed 12 warnings (12 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   13 warnings generated.
   Suppressed 13 warnings (13 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   13 warnings generated.
   Suppressed 13 warnings (13 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   13 warnings generated.
   Suppressed 13 warnings (13 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   13 warnings generated.
   Suppressed 13 warnings (13 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   13 warnings generated.
   Suppressed 13 warnings (13 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   16 warnings generated.
   net/ipv4/ipconfig.c:366:2: warning: Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119 [clang-analyzer-security.insecureAPI.strcpy]
           strcpy(ir.ifr_ifrn.ifrn_name, ic_dev->dev->name);

vim +/ptr +212 net/bluetooth/eir.c

cda1eaab813d24 Luiz Augusto von Dentz 2021-09-20  165  
cda1eaab813d24 Luiz Augusto von Dentz 2021-09-20  166  void eir_create(struct hci_dev *hdev, u8 *data)
cda1eaab813d24 Luiz Augusto von Dentz 2021-09-20  167  {
cda1eaab813d24 Luiz Augusto von Dentz 2021-09-20  168  	u8 *ptr = data;
cda1eaab813d24 Luiz Augusto von Dentz 2021-09-20  169  	size_t name_len;
cda1eaab813d24 Luiz Augusto von Dentz 2021-09-20  170  
cda1eaab813d24 Luiz Augusto von Dentz 2021-09-20  171  	name_len = strlen(hdev->dev_name);
cda1eaab813d24 Luiz Augusto von Dentz 2021-09-20  172  
cda1eaab813d24 Luiz Augusto von Dentz 2021-09-20  173  	if (name_len > 0) {
cda1eaab813d24 Luiz Augusto von Dentz 2021-09-20  174  		/* EIR Data type */
cda1eaab813d24 Luiz Augusto von Dentz 2021-09-20  175  		if (name_len > 48) {
cda1eaab813d24 Luiz Augusto von Dentz 2021-09-20  176  			name_len = 48;
cda1eaab813d24 Luiz Augusto von Dentz 2021-09-20  177  			ptr[1] = EIR_NAME_SHORT;
cda1eaab813d24 Luiz Augusto von Dentz 2021-09-20  178  		} else {
cda1eaab813d24 Luiz Augusto von Dentz 2021-09-20  179  			ptr[1] = EIR_NAME_COMPLETE;
cda1eaab813d24 Luiz Augusto von Dentz 2021-09-20  180  		}
cda1eaab813d24 Luiz Augusto von Dentz 2021-09-20  181  
cda1eaab813d24 Luiz Augusto von Dentz 2021-09-20  182  		/* EIR Data length */
cda1eaab813d24 Luiz Augusto von Dentz 2021-09-20  183  		ptr[0] = name_len + 1;
cda1eaab813d24 Luiz Augusto von Dentz 2021-09-20  184  
cda1eaab813d24 Luiz Augusto von Dentz 2021-09-20  185  		memcpy(ptr + 2, hdev->dev_name, name_len);
cda1eaab813d24 Luiz Augusto von Dentz 2021-09-20  186  
cda1eaab813d24 Luiz Augusto von Dentz 2021-09-20  187  		ptr += (name_len + 2);
cda1eaab813d24 Luiz Augusto von Dentz 2021-09-20  188  	}
cda1eaab813d24 Luiz Augusto von Dentz 2021-09-20  189  
cda1eaab813d24 Luiz Augusto von Dentz 2021-09-20  190  	if (hdev->inq_tx_power != HCI_TX_POWER_INVALID) {
cda1eaab813d24 Luiz Augusto von Dentz 2021-09-20  191  		ptr[0] = 2;
cda1eaab813d24 Luiz Augusto von Dentz 2021-09-20  192  		ptr[1] = EIR_TX_POWER;
cda1eaab813d24 Luiz Augusto von Dentz 2021-09-20  193  		ptr[2] = (u8)hdev->inq_tx_power;
cda1eaab813d24 Luiz Augusto von Dentz 2021-09-20  194  
cda1eaab813d24 Luiz Augusto von Dentz 2021-09-20  195  		ptr += 3;
cda1eaab813d24 Luiz Augusto von Dentz 2021-09-20  196  	}
cda1eaab813d24 Luiz Augusto von Dentz 2021-09-20  197  
cda1eaab813d24 Luiz Augusto von Dentz 2021-09-20  198  	if (hdev->devid_source > 0) {
cda1eaab813d24 Luiz Augusto von Dentz 2021-09-20  199  		ptr[0] = 9;
cda1eaab813d24 Luiz Augusto von Dentz 2021-09-20  200  		ptr[1] = EIR_DEVICE_ID;
cda1eaab813d24 Luiz Augusto von Dentz 2021-09-20  201  
cda1eaab813d24 Luiz Augusto von Dentz 2021-09-20  202  		put_unaligned_le16(hdev->devid_source, ptr + 2);
cda1eaab813d24 Luiz Augusto von Dentz 2021-09-20  203  		put_unaligned_le16(hdev->devid_vendor, ptr + 4);
cda1eaab813d24 Luiz Augusto von Dentz 2021-09-20  204  		put_unaligned_le16(hdev->devid_product, ptr + 6);
cda1eaab813d24 Luiz Augusto von Dentz 2021-09-20  205  		put_unaligned_le16(hdev->devid_version, ptr + 8);
cda1eaab813d24 Luiz Augusto von Dentz 2021-09-20  206  
cda1eaab813d24 Luiz Augusto von Dentz 2021-09-20  207  		ptr += 10;
cda1eaab813d24 Luiz Augusto von Dentz 2021-09-20  208  	}
cda1eaab813d24 Luiz Augusto von Dentz 2021-09-20  209  
cda1eaab813d24 Luiz Augusto von Dentz 2021-09-20  210  	ptr = create_uuid16_list(hdev, ptr, HCI_MAX_EIR_LENGTH - (ptr - data));
cda1eaab813d24 Luiz Augusto von Dentz 2021-09-20  211  	ptr = create_uuid32_list(hdev, ptr, HCI_MAX_EIR_LENGTH - (ptr - data));
cda1eaab813d24 Luiz Augusto von Dentz 2021-09-20 @212  	ptr = create_uuid128_list(hdev, ptr, HCI_MAX_EIR_LENGTH - (ptr - data));
cda1eaab813d24 Luiz Augusto von Dentz 2021-09-20  213  }
cda1eaab813d24 Luiz Augusto von Dentz 2021-09-20  214  

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* net/bluetooth/eir.c:212:2: warning: Value stored to 'ptr' is never read [clang-analyzer-deadcode.DeadStores]
@ 2022-09-03  9:06 kernel test robot
  0 siblings, 0 replies; 3+ messages in thread
From: kernel test robot @ 2022-09-03  9:06 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 18313 bytes --]

:::::: 
:::::: Manual check reason: "low confidence static check warning: net/bluetooth/eir.c:212:2: warning: Value stored to 'ptr' is never read [clang-analyzer-deadcode.DeadStores]"
:::::: 

BCC: lkp(a)intel.com
CC: llvm(a)lists.linux.dev
CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
CC: Marcel Holtmann <marcel@holtmann.org>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   d895ec7938c431fe61a731939da76a6461bc6133
commit: 01ce70b0a274bd76a5a311fb90d4d446d9bdfea1 Bluetooth: eir: Move EIR/Adv Data functions to its own file
date:   12 months ago
:::::: branch date: 9 hours ago
:::::: commit date: 12 months ago
config: arm-randconfig-c002-20220901 (https://download.01.org/0day-ci/archive/20220903/202209031604.MOfwAiBu-lkp(a)intel.com/config)
compiler: clang version 16.0.0 (https://github.com/llvm/llvm-project c55b41d5199d2394dd6cdb8f52180d8b81d809d4)
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=01ce70b0a274bd76a5a311fb90d4d446d9bdfea1
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout 01ce70b0a274bd76a5a311fb90d4d446d9bdfea1
        # save the config file
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm clang-analyzer 

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@intel.com>

clang_analyzer warnings: (new ones prefixed by >>)
               ^~~~~~~~~~~~~
   drivers/tty/serial/serial_mctrl_gpio.c:52:2: note: Taking false branch
           if (gpios == NULL)
           ^
   drivers/tty/serial/serial_mctrl_gpio.c:55:2: note: Loop condition is true.  Entering loop body
           for (i = 0; i < UART_GPIO_MAX; i++)
           ^
   drivers/tty/serial/serial_mctrl_gpio.c:56:7: note: Assuming the condition is true
                   if (gpios->gpio[i] && mctrl_gpio_flags_is_dir_out(i)) {
                       ^~~~~~~~~~~~~~
   drivers/tty/serial/serial_mctrl_gpio.c:56:7: note: Left side of '&&' is true
   drivers/tty/serial/serial_mctrl_gpio.c:56:25: note: Assuming the condition is true
                   if (gpios->gpio[i] && mctrl_gpio_flags_is_dir_out(i)) {
                                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/tty/serial/serial_mctrl_gpio.c:56:3: note: Taking true branch
                   if (gpios->gpio[i] && mctrl_gpio_flags_is_dir_out(i)) {
                   ^
   drivers/tty/serial/serial_mctrl_gpio.c:58:4: note: Calling '__assign_bit'
                           __assign_bit(count, values,
                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/bitops.h:251:6: note: Assuming 'value' is false
           if (value)
               ^~~~~
   include/linux/bitops.h:251:2: note: Taking false branch
           if (value)
           ^
   include/linux/bitops.h:254:3: note: Calling '__clear_bit'
                   __clear_bit(nr, addr);
                   ^~~~~~~~~~~~~~~~~~~~~
   include/asm-generic/bitops/non-atomic.h:29:5: note: The left expression of the compound assignment is an uninitialized value. The computed value will also be garbage
           *p &= ~mask;
           ~~ ^
   6 warnings generated.
   fs/ext4/fast_commit.c:800:2: warning: Value stored to 'dst' is never read [clang-analyzer-deadcode.DeadStores]
           dst += dlen;
           ^      ~~~~
   fs/ext4/fast_commit.c:800:2: note: Value stored to 'dst' is never read
           dst += dlen;
           ^      ~~~~
   fs/ext4/fast_commit.c:1666:2: warning: Value stored to 'ret' is never read [clang-analyzer-deadcode.DeadStores]
           ret = ext4_fc_record_modified_inode(sb, inode->i_ino);
           ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/ext4/fast_commit.c:1666:2: note: Value stored to 'ret' is never read
           ret = ext4_fc_record_modified_inode(sb, inode->i_ino);
           ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/ext4/fast_commit.c:1791:2: warning: Value stored to 'ret' is never read [clang-analyzer-deadcode.DeadStores]
           ret = ext4_fc_record_modified_inode(sb, inode->i_ino);
           ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/ext4/fast_commit.c:1791:2: note: Value stored to 'ret' is never read
           ret = ext4_fc_record_modified_inode(sb, inode->i_ino);
           ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   Suppressed 3 warnings (3 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   2 warnings generated.
   Suppressed 2 warnings (2 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   2 warnings generated.
   Suppressed 2 warnings (2 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   2 warnings generated.
   Suppressed 2 warnings (2 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   2 warnings generated.
   Suppressed 2 warnings (2 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   1 warning generated.
   Suppressed 1 warnings (1 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   1 warning generated.
   Suppressed 1 warnings (1 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   1 warning generated.
   Suppressed 1 warnings (1 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   1 warning generated.
   Suppressed 1 warnings (1 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   1 warning generated.
   Suppressed 1 warnings (1 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   1 warning generated.
   Suppressed 1 warnings (1 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   1 warning generated.
   drivers/iio/chemical/bme680_core.c:741:2: warning: Value stored to 'ret' is never read [clang-analyzer-deadcode.DeadStores]
           ret = regmap_read(data->regmap, BME680_REG_MEAS_STAT_0, &check);
           ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/iio/chemical/bme680_core.c:741:2: note: Value stored to 'ret' is never read
           ret = regmap_read(data->regmap, BME680_REG_MEAS_STAT_0, &check);
           ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   1 warning generated.
   Suppressed 1 warnings (1 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   2 warnings generated.
   Suppressed 2 warnings (2 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   2 warnings generated.
   Suppressed 2 warnings (2 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   4 warnings generated.
>> net/bluetooth/eir.c:212:2: warning: Value stored to 'ptr' is never read [clang-analyzer-deadcode.DeadStores]
           ptr = create_uuid128_list(hdev, ptr, HCI_MAX_EIR_LENGTH - (ptr - data));
           ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/bluetooth/eir.c:212:2: note: Value stored to 'ptr' is never read
           ptr = create_uuid128_list(hdev, ptr, HCI_MAX_EIR_LENGTH - (ptr - data));
           ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/bluetooth/eir.c:295:4: warning: Value stored to 'ptr' is never read [clang-analyzer-deadcode.DeadStores]
                           ptr += 3;
                           ^      ~
   net/bluetooth/eir.c:295:4: note: Value stored to 'ptr' is never read
                           ptr += 3;
                           ^      ~
   Suppressed 2 warnings (2 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   2 warnings generated.
   Suppressed 2 warnings (2 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   2 warnings generated.
   Suppressed 2 warnings (2 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   2 warnings generated.
   Suppressed 2 warnings (2 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   5 warnings generated.
   fs/ubifs/commit.c:113:3: warning: Value stored to 'err' is never read [clang-analyzer-deadcode.DeadStores]
                   err = 0;
                   ^     ~
   fs/ubifs/commit.c:113:3: note: Value stored to 'err' is never read
                   err = 0;
                   ^     ~
   fs/ubifs/commit.c:668:19: warning: Use of memory after it is freed [clang-analyzer-unix.Malloc]
                                   if (iip + 1 < le16_to_cpu(idx->child_cnt)) {
                                                 ^
   include/linux/byteorder/generic.h:91:21: note: expanded from macro 'le16_to_cpu'
   #define le16_to_cpu __le16_to_cpu
                       ^
   include/uapi/linux/byteorder/little_endian.h:36:50: note: expanded from macro '__le16_to_cpu'
   #define __le16_to_cpu(x) ((__force __u16)(__le16)(x))
                                                    ^
   fs/ubifs/commit.c:404:6: note: Assuming field 'cmt_state' is not equal to COMMIT_BROKEN
           if (c->cmt_state == COMMIT_BROKEN) {
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/ubifs/commit.c:404:2: note: Taking false branch
           if (c->cmt_state == COMMIT_BROKEN) {
           ^
   fs/ubifs/commit.c:409:6: note: Assuming field 'cmt_state' is not equal to COMMIT_RUNNING_BACKGROUND
           if (c->cmt_state == COMMIT_RUNNING_BACKGROUND)
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/ubifs/commit.c:409:2: note: Taking false branch
           if (c->cmt_state == COMMIT_RUNNING_BACKGROUND)
           ^
   fs/ubifs/commit.c:416:6: note: Assuming field 'cmt_state' is not equal to COMMIT_RUNNING_REQUIRED
           if (c->cmt_state == COMMIT_RUNNING_REQUIRED) {
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/ubifs/commit.c:416:2: note: Taking false branch
           if (c->cmt_state == COMMIT_RUNNING_REQUIRED) {
           ^
   fs/ubifs/commit.c:430:6: note: Assuming field 'cmt_state' is not equal to COMMIT_BROKEN
           if (c->cmt_state == COMMIT_BROKEN) {
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/ubifs/commit.c:430:2: note: Taking false branch
           if (c->cmt_state == COMMIT_BROKEN) {
           ^
   fs/ubifs/commit.c:435:6: note: Assuming field 'cmt_state' is not equal to COMMIT_RUNNING_BACKGROUND
           if (c->cmt_state == COMMIT_RUNNING_BACKGROUND)
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/ubifs/commit.c:435:2: note: Taking false branch
           if (c->cmt_state == COMMIT_RUNNING_BACKGROUND)
           ^
   fs/ubifs/commit.c:438:6: note: Assuming field 'cmt_state' is not equal to COMMIT_RUNNING_REQUIRED
           if (c->cmt_state == COMMIT_RUNNING_REQUIRED) {
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/ubifs/commit.c:438:2: note: Taking false branch
           if (c->cmt_state == COMMIT_RUNNING_REQUIRED) {
           ^
   fs/ubifs/commit.c:446:8: note: Calling 'do_commit'
           err = do_commit(c);
                 ^~~~~~~~~~~~
   fs/ubifs/commit.c:103:2: note: Taking false branch
           dbg_cmt("start");
           ^
   fs/ubifs/debug.h:190:29: note: expanded from macro 'dbg_cmt'
   #define dbg_cmt(fmt, ...)   ubifs_dbg_msg("cmt", fmt, ##__VA_ARGS__)
                               ^
   fs/ubifs/debug.h:158:2: note: expanded from macro 'ubifs_dbg_msg'
           pr_debug("UBIFS DBG " type " (pid %d): " fmt "\n", current->pid,       \
           ^
   include/linux/printk.h:471:2: note: expanded from macro 'pr_debug'
           dynamic_pr_debug(fmt, ##__VA_ARGS__)
           ^
   include/linux/dynamic_debug.h:162:2: note: expanded from macro 'dynamic_pr_debug'
           _dynamic_func_call(fmt, __dynamic_pr_debug,             \
           ^
   include/linux/dynamic_debug.h:152:2: note: expanded from macro '_dynamic_func_call'
           __dynamic_func_call(__UNIQUE_ID(ddebug), fmt, func, ##__VA_ARGS__)
           ^
   include/linux/dynamic_debug.h:133:2: note: expanded from macro '__dynamic_func_call'
           if (DYNAMIC_DEBUG_BRANCH(id))                   \
           ^
   fs/ubifs/commit.c:103:2: note: Loop condition is false.  Exiting loop
           dbg_cmt("start");

vim +/ptr +212 net/bluetooth/eir.c

01ce70b0a274bd Luiz Augusto von Dentz 2021-09-20  165  
01ce70b0a274bd Luiz Augusto von Dentz 2021-09-20  166  void eir_create(struct hci_dev *hdev, u8 *data)
01ce70b0a274bd Luiz Augusto von Dentz 2021-09-20  167  {
01ce70b0a274bd Luiz Augusto von Dentz 2021-09-20  168  	u8 *ptr = data;
01ce70b0a274bd Luiz Augusto von Dentz 2021-09-20  169  	size_t name_len;
01ce70b0a274bd Luiz Augusto von Dentz 2021-09-20  170  
01ce70b0a274bd Luiz Augusto von Dentz 2021-09-20  171  	name_len = strlen(hdev->dev_name);
01ce70b0a274bd Luiz Augusto von Dentz 2021-09-20  172  
01ce70b0a274bd Luiz Augusto von Dentz 2021-09-20  173  	if (name_len > 0) {
01ce70b0a274bd Luiz Augusto von Dentz 2021-09-20  174  		/* EIR Data type */
01ce70b0a274bd Luiz Augusto von Dentz 2021-09-20  175  		if (name_len > 48) {
01ce70b0a274bd Luiz Augusto von Dentz 2021-09-20  176  			name_len = 48;
01ce70b0a274bd Luiz Augusto von Dentz 2021-09-20  177  			ptr[1] = EIR_NAME_SHORT;
01ce70b0a274bd Luiz Augusto von Dentz 2021-09-20  178  		} else {
01ce70b0a274bd Luiz Augusto von Dentz 2021-09-20  179  			ptr[1] = EIR_NAME_COMPLETE;
01ce70b0a274bd Luiz Augusto von Dentz 2021-09-20  180  		}
01ce70b0a274bd Luiz Augusto von Dentz 2021-09-20  181  
01ce70b0a274bd Luiz Augusto von Dentz 2021-09-20  182  		/* EIR Data length */
01ce70b0a274bd Luiz Augusto von Dentz 2021-09-20  183  		ptr[0] = name_len + 1;
01ce70b0a274bd Luiz Augusto von Dentz 2021-09-20  184  
01ce70b0a274bd Luiz Augusto von Dentz 2021-09-20  185  		memcpy(ptr + 2, hdev->dev_name, name_len);
01ce70b0a274bd Luiz Augusto von Dentz 2021-09-20  186  
01ce70b0a274bd Luiz Augusto von Dentz 2021-09-20  187  		ptr += (name_len + 2);
01ce70b0a274bd Luiz Augusto von Dentz 2021-09-20  188  	}
01ce70b0a274bd Luiz Augusto von Dentz 2021-09-20  189  
01ce70b0a274bd Luiz Augusto von Dentz 2021-09-20  190  	if (hdev->inq_tx_power != HCI_TX_POWER_INVALID) {
01ce70b0a274bd Luiz Augusto von Dentz 2021-09-20  191  		ptr[0] = 2;
01ce70b0a274bd Luiz Augusto von Dentz 2021-09-20  192  		ptr[1] = EIR_TX_POWER;
01ce70b0a274bd Luiz Augusto von Dentz 2021-09-20  193  		ptr[2] = (u8)hdev->inq_tx_power;
01ce70b0a274bd Luiz Augusto von Dentz 2021-09-20  194  
01ce70b0a274bd Luiz Augusto von Dentz 2021-09-20  195  		ptr += 3;
01ce70b0a274bd Luiz Augusto von Dentz 2021-09-20  196  	}
01ce70b0a274bd Luiz Augusto von Dentz 2021-09-20  197  
01ce70b0a274bd Luiz Augusto von Dentz 2021-09-20  198  	if (hdev->devid_source > 0) {
01ce70b0a274bd Luiz Augusto von Dentz 2021-09-20  199  		ptr[0] = 9;
01ce70b0a274bd Luiz Augusto von Dentz 2021-09-20  200  		ptr[1] = EIR_DEVICE_ID;
01ce70b0a274bd Luiz Augusto von Dentz 2021-09-20  201  
01ce70b0a274bd Luiz Augusto von Dentz 2021-09-20  202  		put_unaligned_le16(hdev->devid_source, ptr + 2);
01ce70b0a274bd Luiz Augusto von Dentz 2021-09-20  203  		put_unaligned_le16(hdev->devid_vendor, ptr + 4);
01ce70b0a274bd Luiz Augusto von Dentz 2021-09-20  204  		put_unaligned_le16(hdev->devid_product, ptr + 6);
01ce70b0a274bd Luiz Augusto von Dentz 2021-09-20  205  		put_unaligned_le16(hdev->devid_version, ptr + 8);
01ce70b0a274bd Luiz Augusto von Dentz 2021-09-20  206  
01ce70b0a274bd Luiz Augusto von Dentz 2021-09-20  207  		ptr += 10;
01ce70b0a274bd Luiz Augusto von Dentz 2021-09-20  208  	}
01ce70b0a274bd Luiz Augusto von Dentz 2021-09-20  209  
01ce70b0a274bd Luiz Augusto von Dentz 2021-09-20  210  	ptr = create_uuid16_list(hdev, ptr, HCI_MAX_EIR_LENGTH - (ptr - data));
01ce70b0a274bd Luiz Augusto von Dentz 2021-09-20  211  	ptr = create_uuid32_list(hdev, ptr, HCI_MAX_EIR_LENGTH - (ptr - data));
01ce70b0a274bd Luiz Augusto von Dentz 2021-09-20 @212  	ptr = create_uuid128_list(hdev, ptr, HCI_MAX_EIR_LENGTH - (ptr - data));
01ce70b0a274bd Luiz Augusto von Dentz 2021-09-20  213  }
01ce70b0a274bd Luiz Augusto von Dentz 2021-09-20  214  

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

^ permalink raw reply	[flat|nested] 3+ messages in thread

* net/bluetooth/eir.c:212:2: warning: Value stored to 'ptr' is never read [clang-analyzer-deadcode.DeadStores]
@ 2021-09-27 23:30 kernel test robot
  0 siblings, 0 replies; 3+ messages in thread
From: kernel test robot @ 2021-09-27 23:30 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 18660 bytes --]

CC: llvm(a)lists.linux.dev
CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
CC: 0day robot <lkp@intel.com>

tree:   https://github.com/0day-ci/linux/commits/Luiz-Augusto-von-Dentz/Bluetooth-eir-Move-EIR-Adv-Data-functions-to-its-own-file/20210922-113507
head:   cda1eaab813d24fd5a24abcae5c22e15191ee466
commit: cda1eaab813d24fd5a24abcae5c22e15191ee466 Bluetooth: eir: Move EIR/Adv Data functions to its own file
date:   6 days ago
:::::: branch date: 6 days ago
:::::: commit date: 6 days ago
config: i386-randconfig-c001-20210927 (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://github.com/0day-ci/linux/commit/cda1eaab813d24fd5a24abcae5c22e15191ee466
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Luiz-Augusto-von-Dentz/Bluetooth-eir-Move-EIR-Adv-Data-functions-to-its-own-file/20210922-113507
        git checkout cda1eaab813d24fd5a24abcae5c22e15191ee466
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=i386 clang-analyzer 

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


clang-analyzer warnings: (new ones prefixed by >>)
   6 warnings generated.
   Suppressed 6 warnings (6 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   15 warnings generated.
   drivers/w1/w1.c:997:2: warning: Value stored to 'search_bit' is never read [clang-analyzer-deadcode.DeadStores]
           search_bit = 0;
           ^            ~
   drivers/w1/w1.c:997:2: note: Value stored to 'search_bit' is never read
           search_bit = 0;
           ^            ~
   drivers/w1/w1.c:999:2: warning: Value stored to 'last_rn' is never read [clang-analyzer-deadcode.DeadStores]
           last_rn = 0;
           ^         ~
   drivers/w1/w1.c:999:2: note: Value stored to 'last_rn' is never read
           last_rn = 0;
           ^         ~
   Suppressed 13 warnings (13 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   13 warnings generated.
   Suppressed 13 warnings (13 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   6 warnings generated.
   Suppressed 6 warnings (6 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   13 warnings generated.
   Suppressed 13 warnings (13 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   6 warnings generated.
   Suppressed 6 warnings (6 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   6 warnings generated.
   Suppressed 6 warnings (6 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   6 warnings generated.
   Suppressed 6 warnings (6 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   13 warnings generated.
   Suppressed 13 warnings (13 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   13 warnings generated.
   Suppressed 13 warnings (13 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   13 warnings generated.
   Suppressed 13 warnings (13 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   13 warnings generated.
   Suppressed 13 warnings (13 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   13 warnings generated.
   Suppressed 13 warnings (13 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   16 warnings generated.
   net/sunrpc/auth_gss/gss_mech_switch.c:55:3: warning: Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119 [clang-analyzer-security.insecureAPI.strcpy]
                   strcpy(new, prefix);
                   ^~~~~~
   net/sunrpc/auth_gss/gss_mech_switch.c:55:3: note: Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119
                   strcpy(new, prefix);
                   ^~~~~~
   net/sunrpc/auth_gss/gss_mech_switch.c:56:3: warning: Call to function 'strcat' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcat'. CWE-119 [clang-analyzer-security.insecureAPI.strcpy]
                   strcat(new, name);
                   ^~~~~~
   net/sunrpc/auth_gss/gss_mech_switch.c:56:3: note: Call to function 'strcat' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcat'. CWE-119
                   strcat(new, name);
                   ^~~~~~
   Suppressed 14 warnings (14 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   15 warnings generated.
   net/sunrpc/auth_gss/svcauth_gss.c:1316:3: warning: Value stored to 'status' is never read [clang-analyzer-deadcode.DeadStores]
                   status = -EINVAL;
                   ^        ~~~~~~~
   net/sunrpc/auth_gss/svcauth_gss.c:1316:3: note: Value stored to 'status' is never read
                   status = -EINVAL;
                   ^        ~~~~~~~
   Suppressed 14 warnings (14 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   14 warnings generated.
   Suppressed 14 warnings (14 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   6 warnings generated.
   Suppressed 6 warnings (6 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   7 warnings generated.
   Suppressed 7 warnings (7 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   6 warnings generated.
   Suppressed 6 warnings (6 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   15 warnings generated.
   Suppressed 15 warnings (13 in non-user code, 2 with check filters).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   14 warnings generated.
   Suppressed 14 warnings (14 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   14 warnings generated.
   Suppressed 14 warnings (14 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   14 warnings generated.
   Suppressed 14 warnings (14 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   16 warnings generated.
>> net/bluetooth/eir.c:212:2: warning: Value stored to 'ptr' is never read [clang-analyzer-deadcode.DeadStores]
           ptr = create_uuid128_list(hdev, ptr, HCI_MAX_EIR_LENGTH - (ptr - data));
           ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/bluetooth/eir.c:212:2: note: Value stored to 'ptr' is never read
           ptr = create_uuid128_list(hdev, ptr, HCI_MAX_EIR_LENGTH - (ptr - data));
           ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/bluetooth/eir.c:295:4: warning: Value stored to 'ptr' is never read [clang-analyzer-deadcode.DeadStores]
                           ptr += 3;
                           ^      ~
   net/bluetooth/eir.c:295:4: note: Value stored to 'ptr' is never read
                           ptr += 3;
                           ^      ~
   Suppressed 14 warnings (14 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   14 warnings generated.
   Suppressed 14 warnings (14 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   14 warnings generated.
   Suppressed 14 warnings (14 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   14 warnings generated.
   Suppressed 14 warnings (14 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   15 warnings generated.
   include/linux/list.h:135:13: warning: Use of memory after it is freed [clang-analyzer-unix.Malloc]
           __list_del(entry->prev, entry->next);
                      ^
   net/sunrpc/xprt.c:1783:6: note: Assuming 'xprt' is not equal to NULL
           if (xprt == NULL)
               ^~~~~~~~~~~~
   net/sunrpc/xprt.c:1783:2: note: Taking false branch
           if (xprt == NULL)
           ^
   net/sunrpc/xprt.c:1789:14: note: Assuming 'i' is < 'num_prealloc'
           for (i = 0; i < num_prealloc; i++) {
                       ^~~~~~~~~~~~~~~~
   net/sunrpc/xprt.c:1789:2: note: Loop condition is true.  Entering loop body
           for (i = 0; i < num_prealloc; i++) {
           ^
   net/sunrpc/xprt.c:1791:7: note: Assuming 'req' is null
                   if (!req)
                       ^~~~
   net/sunrpc/xprt.c:1791:3: note: Taking true branch
                   if (!req)
                   ^
   net/sunrpc/xprt.c:1792:4: note: Control jumps to line 1805
                           goto out_free;
                           ^
   net/sunrpc/xprt.c:1805:2: note: Calling 'xprt_free'
           xprt_free(xprt);
           ^~~~~~~~~~~~~~~
   net/sunrpc/xprt.c:1814:2: note: Calling 'xprt_free_all_slots'
           xprt_free_all_slots(xprt);
           ^~~~~~~~~~~~~~~~~~~~~~~~~
   net/sunrpc/xprt.c:1743:2: note: Loop condition is true.  Entering loop body
           while (!list_empty(&xprt->free)) {
           ^
   net/sunrpc/xprt.c:1744:9: note: Left side of '&&' is false
                   req = list_first_entry(&xprt->free, struct rpc_rqst, rq_list);
                         ^
   include/linux/list.h:522:2: note: expanded from macro 'list_first_entry'
           list_entry((ptr)->next, type, member)
           ^
   include/linux/list.h:511:2: note: expanded from macro 'list_entry'
           container_of(ptr, type, member)
           ^
   include/linux/kernel.h:495:61: note: expanded from macro 'container_of'
           BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) &&   \
                                                                      ^
   net/sunrpc/xprt.c:1744:9: note: Taking false branch
                   req = list_first_entry(&xprt->free, struct rpc_rqst, rq_list);
                         ^
   include/linux/list.h:522:2: note: expanded from macro 'list_first_entry'
           list_entry((ptr)->next, type, member)
           ^
   include/linux/list.h:511:2: note: expanded from macro 'list_entry'
           container_of(ptr, type, member)
           ^
   include/linux/kernel.h:495:2: note: expanded from macro 'container_of'
           BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) &&   \
           ^
   note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
   include/linux/compiler_types.h:328:2: note: expanded from macro 'compiletime_assert'
           _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
           ^
   include/linux/compiler_types.h:316:2: note: expanded from macro '_compiletime_assert'
           __compiletime_assert(condition, msg, prefix, suffix)
           ^
   include/linux/compiler_types.h:308:3: note: expanded from macro '__compiletime_assert'
                   if (!(condition))                                       \
                   ^
   net/sunrpc/xprt.c:1744:9: note: Loop condition is false.  Exiting loop
                   req = list_first_entry(&xprt->free, struct rpc_rqst, rq_list);
                         ^
   include/linux/list.h:522:2: note: expanded from macro 'list_first_entry'
           list_entry((ptr)->next, type, member)
           ^
   include/linux/list.h:511:2: note: expanded from macro 'list_entry'
           container_of(ptr, type, member)
           ^
   include/linux/kernel.h:495:2: note: expanded from macro 'container_of'

vim +/ptr +212 net/bluetooth/eir.c

cda1eaab813d24 Luiz Augusto von Dentz 2021-09-20  165  
cda1eaab813d24 Luiz Augusto von Dentz 2021-09-20  166  void eir_create(struct hci_dev *hdev, u8 *data)
cda1eaab813d24 Luiz Augusto von Dentz 2021-09-20  167  {
cda1eaab813d24 Luiz Augusto von Dentz 2021-09-20  168  	u8 *ptr = data;
cda1eaab813d24 Luiz Augusto von Dentz 2021-09-20  169  	size_t name_len;
cda1eaab813d24 Luiz Augusto von Dentz 2021-09-20  170  
cda1eaab813d24 Luiz Augusto von Dentz 2021-09-20  171  	name_len = strlen(hdev->dev_name);
cda1eaab813d24 Luiz Augusto von Dentz 2021-09-20  172  
cda1eaab813d24 Luiz Augusto von Dentz 2021-09-20  173  	if (name_len > 0) {
cda1eaab813d24 Luiz Augusto von Dentz 2021-09-20  174  		/* EIR Data type */
cda1eaab813d24 Luiz Augusto von Dentz 2021-09-20  175  		if (name_len > 48) {
cda1eaab813d24 Luiz Augusto von Dentz 2021-09-20  176  			name_len = 48;
cda1eaab813d24 Luiz Augusto von Dentz 2021-09-20  177  			ptr[1] = EIR_NAME_SHORT;
cda1eaab813d24 Luiz Augusto von Dentz 2021-09-20  178  		} else {
cda1eaab813d24 Luiz Augusto von Dentz 2021-09-20  179  			ptr[1] = EIR_NAME_COMPLETE;
cda1eaab813d24 Luiz Augusto von Dentz 2021-09-20  180  		}
cda1eaab813d24 Luiz Augusto von Dentz 2021-09-20  181  
cda1eaab813d24 Luiz Augusto von Dentz 2021-09-20  182  		/* EIR Data length */
cda1eaab813d24 Luiz Augusto von Dentz 2021-09-20  183  		ptr[0] = name_len + 1;
cda1eaab813d24 Luiz Augusto von Dentz 2021-09-20  184  
cda1eaab813d24 Luiz Augusto von Dentz 2021-09-20  185  		memcpy(ptr + 2, hdev->dev_name, name_len);
cda1eaab813d24 Luiz Augusto von Dentz 2021-09-20  186  
cda1eaab813d24 Luiz Augusto von Dentz 2021-09-20  187  		ptr += (name_len + 2);
cda1eaab813d24 Luiz Augusto von Dentz 2021-09-20  188  	}
cda1eaab813d24 Luiz Augusto von Dentz 2021-09-20  189  
cda1eaab813d24 Luiz Augusto von Dentz 2021-09-20  190  	if (hdev->inq_tx_power != HCI_TX_POWER_INVALID) {
cda1eaab813d24 Luiz Augusto von Dentz 2021-09-20  191  		ptr[0] = 2;
cda1eaab813d24 Luiz Augusto von Dentz 2021-09-20  192  		ptr[1] = EIR_TX_POWER;
cda1eaab813d24 Luiz Augusto von Dentz 2021-09-20  193  		ptr[2] = (u8)hdev->inq_tx_power;
cda1eaab813d24 Luiz Augusto von Dentz 2021-09-20  194  
cda1eaab813d24 Luiz Augusto von Dentz 2021-09-20  195  		ptr += 3;
cda1eaab813d24 Luiz Augusto von Dentz 2021-09-20  196  	}
cda1eaab813d24 Luiz Augusto von Dentz 2021-09-20  197  
cda1eaab813d24 Luiz Augusto von Dentz 2021-09-20  198  	if (hdev->devid_source > 0) {
cda1eaab813d24 Luiz Augusto von Dentz 2021-09-20  199  		ptr[0] = 9;
cda1eaab813d24 Luiz Augusto von Dentz 2021-09-20  200  		ptr[1] = EIR_DEVICE_ID;
cda1eaab813d24 Luiz Augusto von Dentz 2021-09-20  201  
cda1eaab813d24 Luiz Augusto von Dentz 2021-09-20  202  		put_unaligned_le16(hdev->devid_source, ptr + 2);
cda1eaab813d24 Luiz Augusto von Dentz 2021-09-20  203  		put_unaligned_le16(hdev->devid_vendor, ptr + 4);
cda1eaab813d24 Luiz Augusto von Dentz 2021-09-20  204  		put_unaligned_le16(hdev->devid_product, ptr + 6);
cda1eaab813d24 Luiz Augusto von Dentz 2021-09-20  205  		put_unaligned_le16(hdev->devid_version, ptr + 8);
cda1eaab813d24 Luiz Augusto von Dentz 2021-09-20  206  
cda1eaab813d24 Luiz Augusto von Dentz 2021-09-20  207  		ptr += 10;
cda1eaab813d24 Luiz Augusto von Dentz 2021-09-20  208  	}
cda1eaab813d24 Luiz Augusto von Dentz 2021-09-20  209  
cda1eaab813d24 Luiz Augusto von Dentz 2021-09-20  210  	ptr = create_uuid16_list(hdev, ptr, HCI_MAX_EIR_LENGTH - (ptr - data));
cda1eaab813d24 Luiz Augusto von Dentz 2021-09-20  211  	ptr = create_uuid32_list(hdev, ptr, HCI_MAX_EIR_LENGTH - (ptr - data));
cda1eaab813d24 Luiz Augusto von Dentz 2021-09-20 @212  	ptr = create_uuid128_list(hdev, ptr, HCI_MAX_EIR_LENGTH - (ptr - data));
cda1eaab813d24 Luiz Augusto von Dentz 2021-09-20  213  }
cda1eaab813d24 Luiz Augusto von Dentz 2021-09-20  214  

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

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 37600 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-09-03  9:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-25  2:25 net/bluetooth/eir.c:212:2: warning: Value stored to 'ptr' is never read [clang-analyzer-deadcode.DeadStores] kernel test robot
  -- strict thread matches above, loose matches on Subject: below --
2022-09-03  9:06 kernel test robot
2021-09-27 23:30 kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.