CC: [email protected]
CC: [email protected]
CC: [email protected]
TO: Amireddy Mallikarjuna reddy <[email protected]>
CC: Vinod Koul <[email protected]>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   61564e7b3abcb67d57b09afdb4b14b85f8bc1976
commit: 32d31c79a1a4fbc48aab594a4dc9ffa087ab59a3 dmaengine: Add Intel LGM SoC 
DMA support.
date:   10 months ago
:::::: branch date: 6 hours ago
:::::: commit date: 10 months ago
config: x86_64-randconfig-c007-20211117 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 
4c2cf3a314d9131b1b288e7c8ab0c75ac1b2be1d)
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=32d31c79a1a4fbc48aab594a4dc9ffa087ab59a3
        git remote add linus 
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout 32d31c79a1a4fbc48aab594a4dc9ffa087ab59a3
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 
clang-analyzer 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email protected]>


clang-analyzer warnings: (new ones prefixed by >>)
   include/linux/compiler_types.h:304:2: note: expanded from macro 
'__compiletime_assert'
           do {                                                            \
           ^
   net/socket.c:2859:6: note: Assuming the condition is false
           if (len > sizeof(a))
               ^~~~~~~~~~~~~~~
   net/socket.c:2859:2: note: Taking false branch
           if (len > sizeof(a))
           ^
   net/socket.c:2863:6: note: Assuming the condition is false
           if (copy_from_user(a, args, len))
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/socket.c:2863:2: note: Taking false branch
           if (copy_from_user(a, args, len))
           ^
   net/socket.c:2867:6: note: 'err' is 0
           if (err)
               ^~~
   net/socket.c:2867:2: note: Taking false branch
           if (err)
           ^
   net/socket.c:2873:2: note: Control jumps to 'case 17:'  at line 2940
           switch (call) {
           ^
   net/socket.c:2941:9: note: Calling '__sys_recvmsg'
                   err = __sys_recvmsg(a0, (struct user_msghdr __user *)a1,
                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/socket.c:2639:6: note: 'forbid_cmsg_compat' is true
           if (forbid_cmsg_compat && (flags & MSG_CMSG_COMPAT))
               ^~~~~~~~~~~~~~~~~~
   net/socket.c:2639:6: note: Left side of '&&' is true
   net/socket.c:2639:2: note: Taking false branch
           if (forbid_cmsg_compat && (flags & MSG_CMSG_COMPAT))
           ^
   net/socket.c:2643:7: note: 'sock' is non-null
           if (!sock)
                ^~~~
   net/socket.c:2643:2: note: Taking false branch
           if (!sock)
           ^
   net/socket.c:2646:8: note: Calling '___sys_recvmsg'
           err = ___sys_recvmsg(sock, msg, &msg_sys, flags, 0);
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/socket.c:2607:6: note: 'err' is >= 0
           if (err < 0)
               ^~~
   net/socket.c:2607:2: note: Taking false branch
           if (err < 0)
           ^
   net/socket.c:2611:2: note: Argument to kfree() is the address of the local 
variable 'iovstack', which is not memory allocated by malloc()
           kfree(iov);
           ^     ~~~
   net/socket.c:2695:2: warning: Value stored to 'compat_entry' is never read 
[clang-analyzer-deadcode.DeadStores]
           compat_entry = (struct compat_mmsghdr __user *)mmsg;
           ^              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/socket.c:2695:2: note: Value stored to 'compat_entry' is never read
           compat_entry = (struct compat_mmsghdr __user *)mmsg;
           ^              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/socket.c:3561:18: warning: Access to field 'ops' results in a 
dereference of a null pointer [clang-analyzer-core.NullDereference]
           (*newsock)->ops = sock->ops;
           ~~~~~~~~~~~~~~~~^~~~~~~~~~~
   net/socket.c:3549:8: note: Calling 'sock_create_lite'
           err = sock_create_lite(sk->sk_family, sk->sk_type, sk->sk_protocol,
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/socket.c:1199:2: note: 'sock' initialized to a null pointer value
           struct socket *sock = NULL;
           ^~~~~~~~~~~~~~~~~~~
   net/socket.c:1202:6: note: Assuming 'err' is not equal to 0
           if (err)
               ^~~
   net/socket.c:1202:2: note: Taking true branch
           if (err)
           ^
   net/socket.c:1203:3: note: Control jumps to line 1217
                   goto out;
                   ^
   net/socket.c:1217:2: note: Storing null pointer value
           *res = sock;
           ^~~~~~~~~~~
   net/socket.c:3549:8: note: Returning from 'sock_create_lite'
           err = sock_create_lite(sk->sk_family, sk->sk_type, sk->sk_protocol,
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/socket.c:3551:6: note: Assuming 'err' is >= 0
           if (err < 0)
               ^~~~~~~
   net/socket.c:3551:2: note: Taking false branch
           if (err < 0)
           ^
   net/socket.c:3555:6: note: Assuming 'err' is >= 0
           if (err < 0) {
               ^~~~~~~
   net/socket.c:3555:2: note: Taking false branch
           if (err < 0) {
           ^
   net/socket.c:3561:18: note: Access to field 'ops' results in a dereference 
of a null pointer
           (*newsock)->ops = sock->ops;
           ~~~~~~~~~~~~~~~~^~~~~~~~~~~
   Suppressed 2 warnings (1 in non-user code, 1 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.
   2 warnings generated.
>> drivers/dma/lgm/lgm-dma.c:854:2: warning: Value stored to 'reg' is never 
>> read [clang-analyzer-deadcode.DeadStores]
           reg = readl(d->base + DMA_PCTRL); /* read back */
           ^
   drivers/dma/lgm/lgm-dma.c:854:2: note: Value stored to 'reg' is never read
   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.
   3 warnings generated.
   Suppressed 3 warnings (3 with check filters).
   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.
   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.
   drivers/iio/frequency/adf4350.c:33:8: warning: Excessive padding in 'struct 
adf4350_state' (100 padding bytes, where 36 is optimal). 
   Optimal fields order: 
   val, 
   r0_fract, 
   spi, 
   reg, 
   lock_detect_gpiod, 
   pdata, 
   clk, 
   clkin, 
   chspc, 
   fpfd, 
   min_out_freq, 
   freq_req, 
   regs, 
   regs_hw, 
   lock, 
   r0_int, 
   r1_mod, 
   r4_rf_div_sel, 
   consider reordering the fields or adding explicit padding members 
[clang-analyzer-optin.performance.Padding]
   struct adf4350_state {
   ~~~~~~~^~~~~~~~~~~~~~~
   drivers/iio/frequency/adf4350.c:33:8: note: Excessive padding in 'struct 
adf4350_state' (100 padding bytes, where 36 is optimal). Optimal fields order: 
val, r0_fract, spi, reg, lock_detect_gpiod, pdata, clk, clkin, chspc, fpfd, 
min_out_freq, freq_req, regs, regs_hw, lock, r0_int, r1_mod, r4_rf_div_sel, 
consider reordering the fields or adding explicit padding members
   struct adf4350_state {
   ~~~~~~~^~~~~~~~~~~~~~~
   Suppressed 3 warnings (2 in non-user code, 1 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.
   3 warnings generated.
   drivers/iio/frequency/adf4371.c:157:8: warning: Excessive padding in 'struct 
adf4371_state' (86 padding bytes, where 22 is optimal). 
   Optimal fields order: 
   buf, 
   integer, 
   spi, 
   regmap, 
   clkin, 
   chip_info, 
   clkin_freq, 
   fpfd, 
   lock, 
   fract1, 
   fract2, 
   mod2, 
   rf_div_sel, 
   ref_div_factor, 
   consider reordering the fields or adding explicit padding members 
[clang-analyzer-optin.performance.Padding]
   struct adf4371_state {
   ~~~~~~~^~~~~~~~~~~~~~~
   drivers/iio/frequency/adf4371.c:157:8: note: Excessive padding in 'struct 
adf4371_state' (86 padding bytes, where 22 is optimal). Optimal fields order: 
buf, integer, spi, regmap, clkin, chip_info, clkin_freq, fpfd, lock, fract1, 
fract2, mod2, rf_div_sel, ref_div_factor, consider reordering the fields or 
adding explicit padding members
   struct adf4371_state {
   ~~~~~~~^~~~~~~~~~~~~~~
   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.
   4 warnings generated.
   drivers/most/configfs.c:173: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(mdev_link->direction, page);
           ^~~~~~
   drivers/most/configfs.c:173: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(mdev_link->direction, page);
           ^~~~~~
   drivers/most/configfs.c:192: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(mdev_link->datatype, page);
           ^~~~~~
   drivers/most/configfs.c:192: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(mdev_link->datatype, page);
           ^~~~~~
   drivers/most/configfs.c:446: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(mdev_link->name, name);
           ^~~~~~
   drivers/most/configfs.c:446: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(mdev_link->name, name);
           ^~~~~~
   drivers/most/configfs.c:535: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(mdev_link->name, name);

vim +/reg +854 drivers/dma/lgm/lgm-dma.c

32d31c79a1a4fb Amireddy Mallikarjuna reddy 2020-12-03  817  
32d31c79a1a4fb Amireddy Mallikarjuna reddy 2020-12-03  818  static int 
ldma_port_cfg(struct ldma_port *p)
32d31c79a1a4fb Amireddy Mallikarjuna reddy 2020-12-03  819  {
32d31c79a1a4fb Amireddy Mallikarjuna reddy 2020-12-03  820      unsigned long 
flags;
32d31c79a1a4fb Amireddy Mallikarjuna reddy 2020-12-03  821      struct ldma_dev 
*d;
32d31c79a1a4fb Amireddy Mallikarjuna reddy 2020-12-03  822      u32 reg;
32d31c79a1a4fb Amireddy Mallikarjuna reddy 2020-12-03  823  
32d31c79a1a4fb Amireddy Mallikarjuna reddy 2020-12-03  824      d = p->ldev;
32d31c79a1a4fb Amireddy Mallikarjuna reddy 2020-12-03  825      reg = 
FIELD_PREP(DMA_PCTRL_TXENDI, p->txendi);
32d31c79a1a4fb Amireddy Mallikarjuna reddy 2020-12-03  826      reg |= 
FIELD_PREP(DMA_PCTRL_RXENDI, p->rxendi);
32d31c79a1a4fb Amireddy Mallikarjuna reddy 2020-12-03  827  
32d31c79a1a4fb Amireddy Mallikarjuna reddy 2020-12-03  828      if (d->ver == 
DMA_VER22) {
32d31c79a1a4fb Amireddy Mallikarjuna reddy 2020-12-03  829              reg |= 
FIELD_PREP(DMA_PCTRL_TXBL, p->txbl);
32d31c79a1a4fb Amireddy Mallikarjuna reddy 2020-12-03  830              reg |= 
FIELD_PREP(DMA_PCTRL_RXBL, p->rxbl);
32d31c79a1a4fb Amireddy Mallikarjuna reddy 2020-12-03  831      } else {
32d31c79a1a4fb Amireddy Mallikarjuna reddy 2020-12-03  832              reg |= 
FIELD_PREP(DMA_PCTRL_PDEN, p->pkt_drop);
32d31c79a1a4fb Amireddy Mallikarjuna reddy 2020-12-03  833  
32d31c79a1a4fb Amireddy Mallikarjuna reddy 2020-12-03  834              if 
(p->txbl == DMA_BURSTL_32DW)
32d31c79a1a4fb Amireddy Mallikarjuna reddy 2020-12-03  835                      
reg |= DMA_PCTRL_TXBL32;
32d31c79a1a4fb Amireddy Mallikarjuna reddy 2020-12-03  836              else if 
(p->txbl == DMA_BURSTL_16DW)
32d31c79a1a4fb Amireddy Mallikarjuna reddy 2020-12-03  837                      
reg |= DMA_PCTRL_TXBL16;
32d31c79a1a4fb Amireddy Mallikarjuna reddy 2020-12-03  838              else
32d31c79a1a4fb Amireddy Mallikarjuna reddy 2020-12-03  839                      
reg |= FIELD_PREP(DMA_PCTRL_TXBL, DMA_PCTRL_TXBL_8);
32d31c79a1a4fb Amireddy Mallikarjuna reddy 2020-12-03  840  
32d31c79a1a4fb Amireddy Mallikarjuna reddy 2020-12-03  841              if 
(p->rxbl == DMA_BURSTL_32DW)
32d31c79a1a4fb Amireddy Mallikarjuna reddy 2020-12-03  842                      
reg |= DMA_PCTRL_RXBL32;
32d31c79a1a4fb Amireddy Mallikarjuna reddy 2020-12-03  843              else if 
(p->rxbl == DMA_BURSTL_16DW)
32d31c79a1a4fb Amireddy Mallikarjuna reddy 2020-12-03  844                      
reg |= DMA_PCTRL_RXBL16;
32d31c79a1a4fb Amireddy Mallikarjuna reddy 2020-12-03  845              else
32d31c79a1a4fb Amireddy Mallikarjuna reddy 2020-12-03  846                      
reg |= FIELD_PREP(DMA_PCTRL_RXBL, DMA_PCTRL_RXBL_8);
32d31c79a1a4fb Amireddy Mallikarjuna reddy 2020-12-03  847      }
32d31c79a1a4fb Amireddy Mallikarjuna reddy 2020-12-03  848  
32d31c79a1a4fb Amireddy Mallikarjuna reddy 2020-12-03  849      
spin_lock_irqsave(&d->dev_lock, flags);
32d31c79a1a4fb Amireddy Mallikarjuna reddy 2020-12-03  850      
writel(p->portid, d->base + DMA_PS);
32d31c79a1a4fb Amireddy Mallikarjuna reddy 2020-12-03  851      writel(reg, 
d->base + DMA_PCTRL);
32d31c79a1a4fb Amireddy Mallikarjuna reddy 2020-12-03  852      
spin_unlock_irqrestore(&d->dev_lock, flags);
32d31c79a1a4fb Amireddy Mallikarjuna reddy 2020-12-03  853  
32d31c79a1a4fb Amireddy Mallikarjuna reddy 2020-12-03 @854      reg = 
readl(d->base + DMA_PCTRL); /* read back */
32d31c79a1a4fb Amireddy Mallikarjuna reddy 2020-12-03  855      dev_dbg(d->dev, 
"Port Control 0x%08x configuration done\n", reg);
32d31c79a1a4fb Amireddy Mallikarjuna reddy 2020-12-03  856  
32d31c79a1a4fb Amireddy Mallikarjuna reddy 2020-12-03  857      return 0;
32d31c79a1a4fb Amireddy Mallikarjuna reddy 2020-12-03  858  }
32d31c79a1a4fb Amireddy Mallikarjuna reddy 2020-12-03  859  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]

Attachment: .config.gz
Description: application/gzip

_______________________________________________
kbuild mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to