:::::: 
:::::: Manual check reason: "low confidence bisect report"
:::::: Manual check reason: "low confidence static check warning: 
drivers/dma/hisi_dma.c:879:13: warning: use of uninitialized value '<unknown>' 
[CWE-457] [-Wanalyzer-use-of-uninitialized-value]"
:::::: 

BCC: [email protected]
CC: [email protected]
In-Reply-To: <[email protected]>
References: <[email protected]>
TO: Jie Hai <[email protected]>
TO: [email protected]
TO: [email protected]
CC: [email protected]
CC: [email protected]

Hi Jie,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on linus/master]
[also build test WARNING on v6.0-rc3 next-20220901]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    
https://github.com/intel-lab-lkp/linux/commits/Jie-Hai/dmaengine-hisilicon-Add-support-for-hisi-dma-driver/20220830-142733
base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
dcf8e5633e2e69ad60b730ab5905608b756a032f
:::::: branch date: 5 days ago
:::::: commit date: 5 days ago
config: arm-randconfig-c002-20220904 
(https://download.01.org/0day-ci/archive/20220904/[email protected]/config)
compiler: arm-linux-gnueabi-gcc (GCC) 12.1.0
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/intel-lab-lkp/linux/commit/f98ffff8b8aae8e618b6c03a39dc7f85578c0360
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review 
Jie-Hai/dmaengine-hisilicon-Add-support-for-hisi-dma-driver/20220830-142733
        git checkout f98ffff8b8aae8e618b6c03a39dc7f85578c0360
        # save the config file
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross 
ARCH=arm KBUILD_USERCFLAGS='-fanalyzer -Wno-error' 

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

gcc_analyzer warnings: (new ones prefixed by >>)
                     |      |         |
                     |      |         (15) ...to here
                     |
                   'vchan_get_all_descriptors': event 16
                     |
                     |include/linux/list.h:507:12:
                     |  507 |         if (!list_empty(list)) {
                     |      |            ^
                     |      |            |
                     |      |            (16) following 'false' branch...
                     |
                   'vchan_get_all_descriptors': event 17
                     |
                     |drivers/dma/virt-dma.h:183:9:
                     |  183 |         
list_splice_tail_init(&vc->desc_completed, head);
                     |      |         
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                     |      |         |
                     |      |         (17) ...to here
                     |
                   'vchan_get_all_descriptors': event 18
                     |
                     |include/linux/list.h:507:12:
                     |  507 |         if (!list_empty(list)) {
                     |      |            ^
                     |      |            |
                     |      |            (18) following 'false' branch...
                     |
                   'vchan_get_all_descriptors': event 19
                     |
                     |drivers/dma/virt-dma.h:184:9:
                     |  184 |         
list_splice_tail_init(&vc->desc_terminated, head);
                     |      |         
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                     |      |         |
                     |      |         (19) ...to here
                     |
                   'vchan_get_all_descriptors': event 20
                     |
                     |include/linux/list.h:507:12:
                     |  507 |         if (!list_empty(list)) {
                     |      |            ^
                     |      |            |
                     |      |            (20) following 'false' branch...
                     |
                   'vchan_get_all_descriptors': event 21
                     |
                     |drivers/dma/virt-dma.h:185:1:
                     |  185 | }
                     |      | ^
                     |      | |
                     |      | (21) ...to here
                     |
              <------+
              |
            'vchan_free_chan_resources': event 22
              |
              |  194 |         vchan_get_all_descriptors(vc, &head);
              |      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
              |      |         |
              |      |         (22) returning to 'vchan_free_chan_resources' 
from 'vchan_get_all_descriptors'
              |
            'vchan_free_chan_resources': event 23
              |
              |include/linux/list.h:675:14:
              |  675 |              !list_entry_is_head(pos, head, member);     
               \
              |      |              ^
              |      |              |
              |      |              (23) following 'true' branch...
   drivers/dma/virt-dma.h:195:9: note: in expansion of macro 
'list_for_each_entry'
              |  195 |         list_for_each_entry(vd, &head, node)
              |      |         ^~~~~~~~~~~~~~~~~~~
              |
            'vchan_free_chan_resources': event 24
              |
              |include/linux/dmaengine.h:1555:11:
              | 1555 |         tx->flags &= ~DMA_CTRL_REUSE;
              |      |         ~~^~~~~~~
              |      |           |
              |      |           (24) ...to here
              |
            'vchan_free_chan_resources': event 25
              |
              |include/linux/container_of.h:18:15:
              |   18 |         void *__mptr = (void *)(ptr);                    
               \
              |      |               ^~~~~~
              |      |               |
              |      |               (25) use of uninitialized value 
'*vd.node.next' here
   include/linux/list.h:520:9: note: in expansion of macro 'container_of'
              |  520 |         container_of(ptr, type, member)
              |      |         ^~~~~~~~~~~~
   include/linux/list.h:564:9: note: in expansion of macro 'list_entry'
              |  564 |         list_entry((pos)->member.next, typeof(*(pos)), 
member)
              |      |         ^~~~~~~~~~
   include/linux/list.h:676:20: note: in expansion of macro 'list_next_entry'
              |  676 |              pos = list_next_entry(pos, member))
              |      |                    ^~~~~~~~~~~~~~~
   drivers/dma/virt-dma.h:195:9: note: in expansion of macro 
'list_for_each_entry'
              |  195 |         list_for_each_entry(vd, &head, node)
              |      |         ^~~~~~~~~~~~~~~~~~~
              |
   drivers/dma/hisi_dma.c: In function 'hisi_dma_create_chan_dir':
>> drivers/dma/hisi_dma.c:879:13: warning: use of uninitialized value 
>> '<unknown>' [CWE-457] [-Wanalyzer-use-of-uninitialized-value]
     879 |         u32 regs_sz;
         |             ^~~~~~~
     'hisi_dma_create_chan_dir': event 1
       |
       |  879 |         u32 regs_sz;
       |      |             ^~~~~~~
       |      |             |
       |      |             (1) use of uninitialized value '<unknown>' here
       |

vim +879 drivers/dma/hisi_dma.c

f98ffff8b8aae8 Jie Hai 2022-08-30  871  
f98ffff8b8aae8 Jie Hai 2022-08-30  872  static int 
hisi_dma_create_chan_dir(struct hisi_dma_dev *hdma_dev)
f98ffff8b8aae8 Jie Hai 2022-08-30  873  {
f98ffff8b8aae8 Jie Hai 2022-08-30  874          char 
dir_name[HISI_DMA_MAX_DIR_NAME_LEN];
f98ffff8b8aae8 Jie Hai 2022-08-30  875          struct debugfs_regset32 
*regsets;
f98ffff8b8aae8 Jie Hai 2022-08-30  876          struct debugfs_reg32 *regs;
f98ffff8b8aae8 Jie Hai 2022-08-30  877          struct dentry *chan_dir;
f98ffff8b8aae8 Jie Hai 2022-08-30  878          struct device *dev;
f98ffff8b8aae8 Jie Hai 2022-08-30 @879          u32 regs_sz;
f98ffff8b8aae8 Jie Hai 2022-08-30  880          int ret;
f98ffff8b8aae8 Jie Hai 2022-08-30  881          int i;
f98ffff8b8aae8 Jie Hai 2022-08-30  882  
f98ffff8b8aae8 Jie Hai 2022-08-30  883          dev = &hdma_dev->pdev->dev;
f98ffff8b8aae8 Jie Hai 2022-08-30  884  
f98ffff8b8aae8 Jie Hai 2022-08-30  885          regsets = devm_kcalloc(dev, 
hdma_dev->chan_num,
f98ffff8b8aae8 Jie Hai 2022-08-30  886                                 
sizeof(*regsets), GFP_KERNEL);
f98ffff8b8aae8 Jie Hai 2022-08-30  887          if (!regsets)
f98ffff8b8aae8 Jie Hai 2022-08-30  888                  return -ENOMEM;
f98ffff8b8aae8 Jie Hai 2022-08-30  889  
f98ffff8b8aae8 Jie Hai 2022-08-30  890          regs = 
hisi_dma_get_ch_regs(hdma_dev, &regs_sz);
f98ffff8b8aae8 Jie Hai 2022-08-30  891          if (!regs)
f98ffff8b8aae8 Jie Hai 2022-08-30  892                  return -ENOMEM;
f98ffff8b8aae8 Jie Hai 2022-08-30  893  
f98ffff8b8aae8 Jie Hai 2022-08-30  894          for (i = 0; i < 
hdma_dev->chan_num; i++) {
f98ffff8b8aae8 Jie Hai 2022-08-30  895                  regsets[i].regs = regs;
f98ffff8b8aae8 Jie Hai 2022-08-30  896                  regsets[i].nregs = 
regs_sz;
f98ffff8b8aae8 Jie Hai 2022-08-30  897                  regsets[i].base = 
hdma_dev->queue_base + i * HISI_DMA_Q_OFFSET;
f98ffff8b8aae8 Jie Hai 2022-08-30  898                  regsets[i].dev = dev;
f98ffff8b8aae8 Jie Hai 2022-08-30  899  
f98ffff8b8aae8 Jie Hai 2022-08-30  900                  memset(dir_name, 0, 
HISI_DMA_MAX_DIR_NAME_LEN);
f98ffff8b8aae8 Jie Hai 2022-08-30  901                  ret = sprintf(dir_name, 
"channel%d", i);
f98ffff8b8aae8 Jie Hai 2022-08-30  902                  if (ret < 0)
f98ffff8b8aae8 Jie Hai 2022-08-30  903                          return ret;
f98ffff8b8aae8 Jie Hai 2022-08-30  904  
f98ffff8b8aae8 Jie Hai 2022-08-30  905                  chan_dir = 
debugfs_create_dir(dir_name,
f98ffff8b8aae8 Jie Hai 2022-08-30  906                                          
      hdma_dev->dma_dev.dbg_dev_root);
f98ffff8b8aae8 Jie Hai 2022-08-30  907                  
debugfs_create_regset32("regs", 0444, chan_dir, &regsets[i]);
f98ffff8b8aae8 Jie Hai 2022-08-30  908          }
f98ffff8b8aae8 Jie Hai 2022-08-30  909  
f98ffff8b8aae8 Jie Hai 2022-08-30  910          return 0;
f98ffff8b8aae8 Jie Hai 2022-08-30  911  }
f98ffff8b8aae8 Jie Hai 2022-08-30  912  

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp
_______________________________________________
kbuild mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to