All of lore.kernel.org
 help / color / mirror / Atom feed
* [cel:topic-rpc-with-tls-upcall 14/15] net/tls/af_tlsh.c:314:11: warning: Although the value stored to 'newsk' is used in the enclosing expression, the value is never actually read from 'newsk' [clang-analyzer-deadcode.DeadStores]
@ 2021-12-07 14:08 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2021-12-07 14:08 UTC (permalink / raw)
  To: kbuild

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

CC: llvm(a)lists.linux.dev
CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: Chuck Lever <chuck.lever@oracle.com>

tree:   git://git.kernel.org/pub/scm/linux/kernel/git/cel/linux topic-rpc-with-tls-upcall
head:   667fe15e9d8a4b978367248bdf40bcd31620a08d
commit: c6ec67d41918e82616ed6f0ea2c3cb90710f2ee7 [14/15] NET: Add support for PF_TLSH (a TLS handshake listener)
:::::: branch date: 21 hours ago
:::::: commit date: 21 hours ago
config: riscv-randconfig-c006-20211207 (https://download.01.org/0day-ci/archive/20211207/202112072224.ToBlQGuO-lkp(a)intel.com/config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 097a1cb1d5ebb3a0ec4bcaed8ba3ff6a8e33c00a)
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 riscv cross compiling tool for clang build
        # apt-get install binutils-riscv64-linux-gnu
        # https://git.kernel.org/pub/scm/linux/kernel/git/cel/linux.git/commit/?id=c6ec67d41918e82616ed6f0ea2c3cb90710f2ee7
        git remote add cel git://git.kernel.org/pub/scm/linux/kernel/git/cel/linux
        git fetch --no-tags cel topic-rpc-with-tls-upcall
        git checkout c6ec67d41918e82616ed6f0ea2c3cb90710f2ee7
        # save the config file to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=riscv 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 >>)
   drivers/usb/dwc2/hcd_ddma.c:974:2: note: Taking false branch
           if (chan->halt_status == DWC2_HC_XFER_URB_DEQUEUE) {
           ^
   drivers/usb/dwc2/hcd_ddma.c:980:6: note: Assuming 'halt_status' is equal to DWC2_HC_XFER_AHB_ERR
           if (halt_status == DWC2_HC_XFER_AHB_ERR ||
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/usb/dwc2/hcd_ddma.c:980:42: note: Left side of '||' is true
           if (halt_status == DWC2_HC_XFER_AHB_ERR ||
                                                   ^
   drivers/usb/dwc2/hcd_ddma.c:991:13: note: 'halt_status' is equal to DWC2_HC_XFER_AHB_ERR
                   int err = halt_status == DWC2_HC_XFER_AHB_ERR ?
                             ^~~~~~~~~~~
   drivers/usb/dwc2/hcd_ddma.c:991:13: note: '?' condition is true
   drivers/usb/dwc2/hcd_ddma.c:994:3: note: Loop condition is true.  Entering loop body
                   list_for_each_entry_safe(qtd, qtd_tmp, &qh->qtd_list,
                   ^
   include/linux/list.h:717:2: note: expanded from macro 'list_for_each_entry_safe'
           for (pos = list_first_entry(head, typeof(*pos), member),        \
           ^
   drivers/usb/dwc2/hcd_ddma.c:996:8: note: Assuming field 'urb' is null
                           if (qtd->urb) {
                               ^~~~~~~~
   drivers/usb/dwc2/hcd_ddma.c:996:4: note: Taking false branch
                           if (qtd->urb) {
                           ^
   drivers/usb/dwc2/hcd_ddma.c:1006:4: note: Calling 'dwc2_hcd_qtd_unlink_and_free'
                           dwc2_hcd_qtd_unlink_and_free(hsotg, qtd, qh);
                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/usb/dwc2/hcd.h:584:2: note: Memory is released
           kfree(qtd);
           ^~~~~~~~~~
   drivers/usb/dwc2/hcd_ddma.c:1006:4: note: Returning; memory was released
                           dwc2_hcd_qtd_unlink_and_free(hsotg, qtd, qh);
                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/usb/dwc2/hcd_ddma.c:994:3: note: Loop condition is false. Execution continues on line 1009
                   list_for_each_entry_safe(qtd, qtd_tmp, &qh->qtd_list,
                   ^
   include/linux/list.h:717:2: note: expanded from macro 'list_for_each_entry_safe'
           for (pos = list_first_entry(head, typeof(*pos), member),        \
           ^
   drivers/usb/dwc2/hcd_ddma.c:1308:3: note: Returning; memory was released
                   dwc2_complete_isoc_xfer_ddma(hsotg, chan, halt_status);
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/usb/dwc2/hcd_ddma.c:1311:7: note: 'halt_status' is not equal to DWC2_HC_XFER_COMPLETE
                   if (halt_status != DWC2_HC_XFER_COMPLETE ||
                       ^~~~~~~~~~~
   drivers/usb/dwc2/hcd_ddma.c:1311:44: note: Left side of '||' is true
                   if (halt_status != DWC2_HC_XFER_COMPLETE ||
                                                            ^
   drivers/usb/dwc2/hcd_ddma.c:1319:4: note: Use of memory after it is freed
                           list_for_each_entry_safe(qtd, qtd_tmp,
                           ^
   include/linux/list.h:718:7: note: expanded from macro 'list_for_each_entry_safe'
                   n = list_next_entry(pos, member);                       \
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/list.h:557:2: note: expanded from macro 'list_next_entry'
           list_entry((pos)->member.next, typeof(*(pos)), member)
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/list.h:513:2: note: expanded from macro 'list_entry'
           container_of(ptr, type, member)
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/container_of.h:18:25: note: expanded from macro 'container_of'
           void *__mptr = (void *)(ptr);                                   \
                                  ^~~~~
   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.
   3 warnings generated.
   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.
   3 warnings generated.
   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.
   5 warnings generated.
   drivers/hwmon/stts751.c:685:3: warning: Value stored to 'name' is never read [clang-analyzer-deadcode.DeadStores]
                   name = "STTS751-0";
                   ^      ~~~~~~~~~~~
   drivers/hwmon/stts751.c:685:3: note: Value stored to 'name' is never read
                   name = "STTS751-0";
                   ^      ~~~~~~~~~~~
   drivers/hwmon/stts751.c:688:3: warning: Value stored to 'name' is never read [clang-analyzer-deadcode.DeadStores]
                   name = "STTS751-1";
                   ^      ~~~~~~~~~~~
   drivers/hwmon/stts751.c:688:3: note: Value stored to 'name' is never read
                   name = "STTS751-1";
                   ^      ~~~~~~~~~~~
   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.
   3 warnings generated.
   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.
   3 warnings generated.
   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.
   4 warnings generated.
>> net/tls/af_tlsh.c:314:11: warning: Although the value stored to 'newsk' is used in the enclosing expression, the value is never actually read from 'newsk' [clang-analyzer-deadcode.DeadStores]
           while (!(newsk = tlsh_accept_dequeue(sk, newsock))) {
                    ^       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/tls/af_tlsh.c:314:11: note: Although the value stored to 'newsk' is used in the enclosing expression, the value is never actually read from 'newsk'
           while (!(newsk = tlsh_accept_dequeue(sk, newsock))) {
                    ^       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   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.
   3 warnings generated.
   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.
   6 warnings generated.
   net/tls/tls_sw.c:407:2: warning: Use of memory after it is freed [clang-analyzer-unix.Malloc]
           list_for_each_entry_safe(rec, tmp, &ctx->tx_list, list) {
           ^
   include/linux/list.h:718:7: note: expanded from macro 'list_for_each_entry_safe'
                   n = list_next_entry(pos, member);                       \
                       ^
   include/linux/list.h:557:2: note: expanded from macro 'list_next_entry'
           list_entry((pos)->member.next, typeof(*(pos)), member)
           ^
   include/linux/list.h:513:2: note: expanded from macro 'list_entry'
           container_of(ptr, type, member)
           ^
   include/linux/container_of.h:18:25: note: expanded from macro 'container_of'
           void *__mptr = (void *)(ptr);                                   \
                                  ^
   net/tls/tls_sw.c:2288:15: note: Assuming 'tls_ctx' is non-null
           if (unlikely(!tls_ctx))
                        ^
   include/linux/compiler.h:78:42: note: expanded from macro 'unlikely'
   # define unlikely(x)    __builtin_expect(!!(x), 0)
                                               ^
   net/tls/tls_sw.c:2288:2: note: Taking false branch
           if (unlikely(!tls_ctx))
           ^
   net/tls/tls_sw.c:2292:6: note: Assuming the condition is false
           if (test_bit(BIT_TX_CLOSING, &ctx->tx_bitmask))
               ^
   include/asm-generic/bitops/non-atomic.h:120:18: note: expanded from macro 'test_bit'
   #define test_bit arch_test_bit
                    ^
   net/tls/tls_sw.c:2292:2: note: Taking false branch
           if (test_bit(BIT_TX_CLOSING, &ctx->tx_bitmask))
           ^
   net/tls/tls_sw.c:2295:6: note: Assuming the condition is false
           if (!test_and_clear_bit(BIT_TX_SCHEDULED, &ctx->tx_bitmask))
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/tls/tls_sw.c:2295:2: note: Taking false branch
           if (!test_and_clear_bit(BIT_TX_SCHEDULED, &ctx->tx_bitmask))
           ^
   net/tls/tls_sw.c:2299:2: note: Calling 'tls_tx_records'
           tls_tx_records(sk, -1);
           ^~~~~~~~~~~~~~~~~~~~~~
   net/tls/tls_sw.c:385:2: note: Taking true branch
           if (tls_is_partially_sent_record(tls_ctx)) {
           ^
   net/tls/tls_sw.c:389:3: note: Taking true branch
                   if (flags == -1)
                   ^
   net/tls/tls_sw.c:395:7: note: Assuming 'rc' is 0
                   if (rc)
                       ^~
   net/tls/tls_sw.c:395:3: note: Taking false branch
                   if (rc)
                   ^
   net/tls/tls_sw.c:403:3: note: Memory is released
                   kfree(rec);
                   ^~~~~~~~~~
   net/tls/tls_sw.c:407:2: note: Use of memory after it is freed
           list_for_each_entry_safe(rec, tmp, &ctx->tx_list, list) {
           ^
   include/linux/list.h:718:7: note: expanded from macro 'list_for_each_entry_safe'
                   n = list_next_entry(pos, member);                       \
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/list.h:557:2: note: expanded from macro 'list_next_entry'
           list_entry((pos)->member.next, typeof(*(pos)), member)
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/list.h:513:2: note: expanded from macro 'list_entry'
           container_of(ptr, type, member)
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/container_of.h:18:25: note: expanded from macro 'container_of'
           void *__mptr = (void *)(ptr);                                   \
                                  ^~~~~
   net/tls/tls_sw.c:1963:5: warning: Value stored to 'decrypted' is never read [clang-analyzer-deadcode.DeadStores]
                                   decrypted = 0;
                                   ^           ~
   net/tls/tls_sw.c:1963:5: note: Value stored to 'decrypted' is never read
                                   decrypted = 0;
                                   ^           ~
   net/tls/tls_sw.c:2212:2: warning: Use of memory after it is freed [clang-analyzer-unix.Malloc]
           list_for_each_entry_safe(rec, tmp, &ctx->tx_list, list) {
           ^
   include/linux/list.h:718:7: note: expanded from macro 'list_for_each_entry_safe'
                   n = list_next_entry(pos, member);                       \
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/list.h:557:2: note: expanded from macro 'list_next_entry'
           list_entry((pos)->member.next, typeof(*(pos)), member)
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/list.h:513:2: note: expanded from macro 'list_entry'
           container_of(ptr, type, member)

vim +314 net/tls/af_tlsh.c

c6ec67d41918e8 Chuck Lever 2021-11-19  283  
c6ec67d41918e8 Chuck Lever 2021-11-19  284  /**
c6ec67d41918e8 Chuck Lever 2021-11-19  285   * tlsh_accept - return a connection waiting for a TLS handshake
c6ec67d41918e8 Chuck Lever 2021-11-19  286   * @sock: listener socket which connection requests arrive on
c6ec67d41918e8 Chuck Lever 2021-11-19  287   * @newsock: socket to move incoming connection to
c6ec67d41918e8 Chuck Lever 2021-11-19  288   * @flags: SOCK_NONBLOCK and/or SOCK_CLOEXEC
c6ec67d41918e8 Chuck Lever 2021-11-19  289   * @kern: 'true' for kernel-internal sockets (ignored)
c6ec67d41918e8 Chuck Lever 2021-11-19  290   *
c6ec67d41918e8 Chuck Lever 2021-11-19  291   * Return values:
c6ec67d41918e8 Chuck Lever 2021-11-19  292   *   %0: @newsock has been initialized.
c6ec67d41918e8 Chuck Lever 2021-11-19  293   *   %-EPERM: caller is not privileged
c6ec67d41918e8 Chuck Lever 2021-11-19  294   */
c6ec67d41918e8 Chuck Lever 2021-11-19  295  static int tlsh_accept(struct socket *sock, struct socket *newsock, int flags,
c6ec67d41918e8 Chuck Lever 2021-11-19  296  		       bool kern)
c6ec67d41918e8 Chuck Lever 2021-11-19  297  {
c6ec67d41918e8 Chuck Lever 2021-11-19  298  	struct sock *sk = sock->sk, *newsk;
c6ec67d41918e8 Chuck Lever 2021-11-19  299  	DECLARE_WAITQUEUE(wait, current);
c6ec67d41918e8 Chuck Lever 2021-11-19  300  	long timeo;
c6ec67d41918e8 Chuck Lever 2021-11-19  301  	int rc;
c6ec67d41918e8 Chuck Lever 2021-11-19  302  
c6ec67d41918e8 Chuck Lever 2021-11-19  303  	if (!capable(CAP_NET_BIND_SERVICE))
c6ec67d41918e8 Chuck Lever 2021-11-19  304  		return -EPERM;
c6ec67d41918e8 Chuck Lever 2021-11-19  305  
c6ec67d41918e8 Chuck Lever 2021-11-19  306  	lock_sock(sk);
c6ec67d41918e8 Chuck Lever 2021-11-19  307  	rc = -EBADF;
c6ec67d41918e8 Chuck Lever 2021-11-19  308  	if (sk->sk_state != TCP_LISTEN)
c6ec67d41918e8 Chuck Lever 2021-11-19  309  		goto out;
c6ec67d41918e8 Chuck Lever 2021-11-19  310  
c6ec67d41918e8 Chuck Lever 2021-11-19  311  	timeo = sock_rcvtimeo(sk, flags & O_NONBLOCK);
c6ec67d41918e8 Chuck Lever 2021-11-19  312  
c6ec67d41918e8 Chuck Lever 2021-11-19  313  	add_wait_queue_exclusive(sk_sleep(sk), &wait);
c6ec67d41918e8 Chuck Lever 2021-11-19 @314  	while (!(newsk = tlsh_accept_dequeue(sk, newsock))) {
c6ec67d41918e8 Chuck Lever 2021-11-19  315  		set_current_state(TASK_INTERRUPTIBLE);
c6ec67d41918e8 Chuck Lever 2021-11-19  316  		if (!timeo) {
c6ec67d41918e8 Chuck Lever 2021-11-19  317  			rc = -EAGAIN;
c6ec67d41918e8 Chuck Lever 2021-11-19  318  			break;
c6ec67d41918e8 Chuck Lever 2021-11-19  319  		}
c6ec67d41918e8 Chuck Lever 2021-11-19  320  
c6ec67d41918e8 Chuck Lever 2021-11-19  321  		release_sock(sk);
c6ec67d41918e8 Chuck Lever 2021-11-19  322  		timeo = schedule_timeout(timeo);
c6ec67d41918e8 Chuck Lever 2021-11-19  323  		lock_sock(sk);
c6ec67d41918e8 Chuck Lever 2021-11-19  324  
c6ec67d41918e8 Chuck Lever 2021-11-19  325  		if (sk->sk_state != TCP_LISTEN) {
c6ec67d41918e8 Chuck Lever 2021-11-19  326  			rc = -EBADF;
c6ec67d41918e8 Chuck Lever 2021-11-19  327  			break;
c6ec67d41918e8 Chuck Lever 2021-11-19  328  		}
c6ec67d41918e8 Chuck Lever 2021-11-19  329  
c6ec67d41918e8 Chuck Lever 2021-11-19  330  		if (signal_pending(current)) {
c6ec67d41918e8 Chuck Lever 2021-11-19  331  			rc = sock_intr_errno(timeo);
c6ec67d41918e8 Chuck Lever 2021-11-19  332  			break;
c6ec67d41918e8 Chuck Lever 2021-11-19  333  		}
c6ec67d41918e8 Chuck Lever 2021-11-19  334  	}
c6ec67d41918e8 Chuck Lever 2021-11-19  335  	set_current_state(TASK_RUNNING);
c6ec67d41918e8 Chuck Lever 2021-11-19  336  	remove_wait_queue(sk_sleep(sk), &wait);
c6ec67d41918e8 Chuck Lever 2021-11-19  337  	if (rc)
c6ec67d41918e8 Chuck Lever 2021-11-19  338  		goto out;
c6ec67d41918e8 Chuck Lever 2021-11-19  339  
c6ec67d41918e8 Chuck Lever 2021-11-19  340  	sk->sk_state = TCP_LISTEN;
c6ec67d41918e8 Chuck Lever 2021-11-19  341  	sk_acceptq_removed(sk);
c6ec67d41918e8 Chuck Lever 2021-11-19  342  out:
c6ec67d41918e8 Chuck Lever 2021-11-19  343  	release_sock(sk);
c6ec67d41918e8 Chuck Lever 2021-11-19  344  	return rc;
c6ec67d41918e8 Chuck Lever 2021-11-19  345  }
c6ec67d41918e8 Chuck Lever 2021-11-19  346  

---
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] only message in thread

only message in thread, other threads:[~2021-12-07 14:08 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-12-07 14:08 [cel:topic-rpc-with-tls-upcall 14/15] net/tls/af_tlsh.c:314:11: warning: Although the value stored to 'newsk' is used in the enclosing expression, the value is never actually read from 'newsk' [clang-analyzer-deadcode.DeadStores] 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.