CC: [email protected]
CC: [email protected]
CC: [email protected]
TO: Yafang Shao <[email protected]>
CC: Peter Zijlstra <[email protected]>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git 
sched/core
head:   2dfdb3d20ad50e2ae2cb84cbceb0f0fc75e79e5d
commit: 2dfdb3d20ad50e2ae2cb84cbceb0f0fc75e79e5d [19/19] sched, dl: support 
schedstats for deadline sched class
:::::: branch date: 3 days ago
:::::: commit date: 3 days ago
config: riscv-randconfig-c006-20210912 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 
261cbe98c38f8c1ee1a482fe76511110e790f58a)
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/peterz/queue.git/commit/?id=2dfdb3d20ad50e2ae2cb84cbceb0f0fc75e79e5d
        git remote add peterz-queue 
https://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git
        git fetch --no-tags peterz-queue sched/core
        git checkout 2dfdb3d20ad50e2ae2cb84cbceb0f0fc75e79e5d
        # save the attached .config 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 <[email protected]>


clang-analyzer warnings: (new ones prefixed by >>)
   include/linux/list.h:628:13: note: expanded from macro 'list_for_each_entry'
           for (pos = list_first_entry(head, typeof(*pos), member);        \
                      ^
   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)
           ^
   note: (skipping 2 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:306:2: note: expanded from macro 
'__compiletime_assert'
           do {                                                            \
           ^
   drivers/scsi/libsas/sas_expander.c:1852:2: note: Loop condition is true.  
Entering loop body
           list_for_each_entry(ch, &ex->children, siblings) {
           ^
   include/linux/list.h:628:2: note: expanded from macro 'list_for_each_entry'
           for (pos = list_first_entry(head, typeof(*pos), member);        \
           ^
   drivers/scsi/libsas/sas_expander.c:1853:3: note: Taking true branch
                   if (dev_is_expander(ch->dev_type)) {
                   ^
   drivers/scsi/libsas/sas_expander.c:1854:10: note: Calling 
'sas_find_bcast_dev'
                           res = sas_find_bcast_dev(ch, src_dev);
                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/scsi/libsas/sas_expander.c:1833:8: note: Calling 
'sas_get_ex_change_count'
           res = sas_get_ex_change_count(dev, &ex_change_count);
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/scsi/libsas/sas_expander.c:1783:6: note: Assuming 'rg_req' is 
non-null
           if (!rg_req)
               ^~~~~~~
   drivers/scsi/libsas/sas_expander.c:1783:2: note: Taking false branch
           if (!rg_req)
           ^
   drivers/scsi/libsas/sas_expander.c:1786:12: note: Calling 'alloc_smp_resp'
           rg_resp = alloc_smp_resp(RG_RESP_SIZE);
                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/scsi/libsas/sas_expander.c:163:9: note: Calling 'kzalloc'
           return kzalloc(size, GFP_KERNEL);
                  ^~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/slab.h:686:9: note: Uninitialized value stored to field 
'result'
           return kmalloc(size, flags | __GFP_ZERO);
                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/slab.h:686:2: note: Returning pointer, which participates in a 
condition later
           return kmalloc(size, flags | __GFP_ZERO);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/scsi/libsas/sas_expander.c:163:9: note: Returning from 'kzalloc'
           return kzalloc(size, GFP_KERNEL);
                  ^~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/scsi/libsas/sas_expander.c:163:2: note: Returning pointer, which 
participates in a condition later
           return kzalloc(size, GFP_KERNEL);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/scsi/libsas/sas_expander.c:1786:12: note: Returning from 
'alloc_smp_resp'
           rg_resp = alloc_smp_resp(RG_RESP_SIZE);
                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/scsi/libsas/sas_expander.c:1787:6: note: Assuming 'rg_resp' is 
non-null
           if (!rg_resp) {
               ^~~~~~~~
   drivers/scsi/libsas/sas_expander.c:1787:2: note: Taking false branch
           if (!rg_resp) {
           ^
   drivers/scsi/libsas/sas_expander.c:1794:8: note: Calling 'smp_execute_task'
           res = smp_execute_task(dev, rg_req, RG_REQ_SIZE, rg_resp,
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/scsi/libsas/sas_expander.c:148:2: note: Returning without writing to 
'resp->result'
           return smp_execute_task_sg(dev, &req_sg, &resp_sg);
           ^
   drivers/scsi/libsas/sas_expander.c:148:2: note: Returning value, which 
participates in a condition later
           return smp_execute_task_sg(dev, &req_sg, &resp_sg);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/scsi/libsas/sas_expander.c:1794:8: note: Returning from 
'smp_execute_task'
           res = smp_execute_task(dev, rg_req, RG_REQ_SIZE, rg_resp,
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/scsi/libsas/sas_expander.c:1796:6: note: Assuming 'res' is 0
           if (res)
               ^~~
   drivers/scsi/libsas/sas_expander.c:1796:2: note: Taking false branch
           if (res)
           ^
   drivers/scsi/libsas/sas_expander.c:1798:22: note: The left operand of '!=' 
is a garbage value
           if (rg_resp->result != SMP_RESP_FUNC_ACC) {
               ~~~~~~~~~~~~~~~ ^
   Suppressed 10 warnings (10 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.
   kernel/sched/rt.c:2286:6: warning: Value stored to 'this_cpu' during its 
initialization is never read [clang-analyzer-deadcode.DeadStores]
           int this_cpu = this_rq->cpu, cpu;
               ^~~~~~~~   ~~~~~~~~~~~~
   kernel/sched/rt.c:2286:6: note: Value stored to 'this_cpu' during its 
initialization is never read
           int this_cpu = this_rq->cpu, cpu;
               ^~~~~~~~   ~~~~~~~~~~~~
   Suppressed 15 warnings (11 in non-user code, 4 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.
   15 warnings generated.
>> kernel/sched/deadline.c:1534:22: warning: Value stored to 'p' during its 
>> initialization is never read [clang-analyzer-deadcode.DeadStores]
           struct task_struct *p = dl_task_of(dl_se);
                               ^   ~~~~~~~~~~~~~~~~~
   kernel/sched/deadline.c:1534:22: note: Value stored to 'p' during its 
initialization is never read
           struct task_struct *p = dl_task_of(dl_se);
                               ^   ~~~~~~~~~~~~~~~~~
   Suppressed 14 warnings (11 in non-user code, 3 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.
   11 warnings generated.
   Suppressed 11 warnings (11 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.
   11 warnings generated.
   Suppressed 11 warnings (11 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.
   11 warnings generated.
   Suppressed 11 warnings (11 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.
   11 warnings generated.
   Suppressed 11 warnings (11 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.
   Suppressed 5 warnings (5 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.
   Suppressed 5 warnings (5 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.
   16 warnings generated.
   drivers/most/core.c:175: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(buf, "");
           ^~~~~~
   drivers/most/core.c:175: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(buf, "");
           ^~~~~~
   drivers/most/core.c:177: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(buf, "rx ");
                   ^~~~~~
   drivers/most/core.c:177: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(buf, "rx ");
                   ^~~~~~
   drivers/most/core.c:179: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(buf, "tx ");
                   ^~~~~~
   drivers/most/core.c:179: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(buf, "tx ");
                   ^~~~~~
   drivers/most/core.c:180:2: 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(buf, "\n");
           ^~~~~~
   drivers/most/core.c:180:2: 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(buf, "\n");
           ^~~~~~
   drivers/most/core.c:191: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(buf, "");
           ^~~~~~
   drivers/most/core.c:191: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(buf, "");
           ^~~~~~
   drivers/most/core.c:193: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(buf, "control ");
                   ^~~~~~
   drivers/most/core.c:193: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(buf, "control ");
                   ^~~~~~
   drivers/most/core.c:195: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(buf, "async ");
                   ^~~~~~
   drivers/most/core.c:195: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(buf, "async ");
                   ^~~~~~
   drivers/most/core.c:197: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(buf, "sync ");
                   ^~~~~~
   drivers/most/core.c:197: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(buf, "sync ");
                   ^~~~~~
   drivers/most/core.c:199: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(buf, "isoc ");
                   ^~~~~~
   drivers/most/core.c:199: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(buf, "isoc ");
                   ^~~~~~
   drivers/most/core.c:200:2: 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(buf, "\n");
           ^~~~~~
   drivers/most/core.c:200:2: 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(buf, "\n");
           ^~~~~~
   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.
   8 warnings generated.
   Suppressed 8 warnings (8 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.

vim +/p +1534 kernel/sched/deadline.c

2dfdb3d20ad50e Yafang Shao 2021-09-05  1529  
2dfdb3d20ad50e Yafang Shao 2021-09-05  1530  static inline void
2dfdb3d20ad50e Yafang Shao 2021-09-05  1531  update_stats_dequeue_dl(struct 
dl_rq *dl_rq, struct sched_dl_entity *dl_se,
2dfdb3d20ad50e Yafang Shao 2021-09-05  1532                     int flags)
2dfdb3d20ad50e Yafang Shao 2021-09-05  1533  {
2dfdb3d20ad50e Yafang Shao 2021-09-05 @1534     struct task_struct *p = 
dl_task_of(dl_se);
2dfdb3d20ad50e Yafang Shao 2021-09-05  1535  
2dfdb3d20ad50e Yafang Shao 2021-09-05  1536     if (!schedstat_enabled())
2dfdb3d20ad50e Yafang Shao 2021-09-05  1537             return;
2dfdb3d20ad50e Yafang Shao 2021-09-05  1538  
2dfdb3d20ad50e Yafang Shao 2021-09-05  1539     if ((flags & DEQUEUE_SLEEP)) {
2dfdb3d20ad50e Yafang Shao 2021-09-05  1540             unsigned int state;
2dfdb3d20ad50e Yafang Shao 2021-09-05  1541  
2dfdb3d20ad50e Yafang Shao 2021-09-05  1542             state = 
READ_ONCE(p->__state);
2dfdb3d20ad50e Yafang Shao 2021-09-05  1543             if (state & 
TASK_INTERRUPTIBLE)
2dfdb3d20ad50e Yafang Shao 2021-09-05  1544                     
__schedstat_set(p->stats.sleep_start,
2dfdb3d20ad50e Yafang Shao 2021-09-05  1545                                     
rq_clock(rq_of_dl_rq(dl_rq)));
2dfdb3d20ad50e Yafang Shao 2021-09-05  1546  
2dfdb3d20ad50e Yafang Shao 2021-09-05  1547             if (state & 
TASK_UNINTERRUPTIBLE)
2dfdb3d20ad50e Yafang Shao 2021-09-05  1548                     
__schedstat_set(p->stats.block_start,
2dfdb3d20ad50e Yafang Shao 2021-09-05  1549                                     
rq_clock(rq_of_dl_rq(dl_rq)));
2dfdb3d20ad50e Yafang Shao 2021-09-05  1550     }
2dfdb3d20ad50e Yafang Shao 2021-09-05  1551  }
2dfdb3d20ad50e Yafang Shao 2021-09-05  1552  

---
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