CC: [email protected]
CC: [email protected]
In-Reply-To: <[email protected]>
References: <[email protected]>
TO: Nitesh Shetty <[email protected]>
TO: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]

Hi Nitesh,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on axboe-block/for-next]
[cannot apply to device-mapper-dm/for-next]
[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]

url:    
https://github.com/0day-ci/linux/commits/Nitesh-Shetty/block-make-bio_map_kern-non-static/20220207-231407
base:   https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git 
for-next
:::::: branch date: 2 days ago
:::::: commit date: 2 days ago
config: riscv-randconfig-c006-20220209 
(https://download.01.org/0day-ci/archive/20220210/[email protected]/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 
e8bff9ae54a55b4dbfeb6ba55f723abbd81bf494)
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://github.com/0day-ci/linux/commit/6bb6ea64499e1ac27975e79bb2eee89f07861893
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review 
Nitesh-Shetty/block-make-bio_map_kern-non-static/20220207-231407
        git checkout 6bb6ea64499e1ac27975e79bb2eee89f07861893
        # 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 <[email protected]>


clang-analyzer warnings: (new ones prefixed by >>)
   10 warnings generated.
   Suppressed 10 warnings (3 in non-user code, 7 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.
   10 warnings generated.
   Suppressed 10 warnings (3 in non-user code, 7 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.
   10 warnings generated.
   Suppressed 10 warnings (3 in non-user code, 7 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.
   10 warnings generated.
   Suppressed 10 warnings (3 in non-user code, 7 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.
   10 warnings generated.
   Suppressed 10 warnings (3 in non-user code, 7 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.
   10 warnings generated.
   Suppressed 10 warnings (3 in non-user code, 7 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.
   9 warnings generated.
   Suppressed 9 warnings (2 in non-user code, 7 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.
   drivers/of/property.c:920:19: warning: Access to field 'full_name' results 
in a dereference of a null pointer [clang-analyzer-core.NullDereference]
           return kbasename(to_of_node(fwnode)->full_name);
                            ^
   include/linux/of.h:161:2: note: expanded from macro 'to_of_node'
           ({                                                              \
           ^
   drivers/of/property.c:920:19: note: '?' condition is false
           return kbasename(to_of_node(fwnode)->full_name);
                            ^
   include/linux/of.h:164:3: note: expanded from macro 'to_of_node'
                   is_of_node(__to_of_node_fwnode) ?                       \
                   ^
   drivers/of/property.c:920:19: note: Access to field 'full_name' results in a 
dereference of a null pointer
           return kbasename(to_of_node(fwnode)->full_name);
                            ^
   include/linux/of.h:161:2: note: expanded from macro 'to_of_node'
           ({                                                              \
           ^
   drivers/of/property.c:926:7: warning: Access to field 'parent' results in a 
dereference of a null pointer [clang-analyzer-core.NullDereference]
           if (!to_of_node(fwnode)->parent)
                ^
   include/linux/of.h:161:2: note: expanded from macro 'to_of_node'
           ({                                                              \
           ^
   drivers/of/property.c:926:7: note: '?' condition is false
           if (!to_of_node(fwnode)->parent)
                ^
   include/linux/of.h:164:3: note: expanded from macro 'to_of_node'
                   is_of_node(__to_of_node_fwnode) ?                       \
                   ^
   drivers/of/property.c:926:7: note: Access to field 'parent' results in a 
dereference of a null pointer
           if (!to_of_node(fwnode)->parent)
                ^
   include/linux/of.h:161:2: note: expanded from macro 'to_of_node'
           ({                                                              \
           ^
   Suppressed 9 warnings (2 in non-user code, 7 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.
   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.
   12 warnings generated.
   drivers/nvme/target/io-cmd-file.c:377:11: warning: The right operand of '!=' 
is a garbage value [clang-analyzer-core.UndefinedBinaryOperatorResult]
                   if (ret != len) {
                           ^  ~~~
   drivers/nvme/target/io-cmd-file.c:356:15: note: 'len' declared without an 
initial value
           int ret = 0, len, src, id;
                        ^~~
   drivers/nvme/target/io-cmd-file.c:360:15: note: Assuming the condition is 
false
           if (unlikely(pos + req->transfer_len > req->ns->size)) {
                        ^
   include/linux/compiler.h:78:42: note: expanded from macro 'unlikely'
   # define unlikely(x)    __builtin_expect(!!(x), 0)
                                               ^
   drivers/nvme/target/io-cmd-file.c:360:2: note: Taking false branch
           if (unlikely(pos + req->transfer_len > req->ns->size)) {
           ^
   drivers/nvme/target/io-cmd-file.c:365:16: note: 'id' is < 'nr_range'
           for (id = 0 ; id < nr_range; id++) {
                         ^~
   drivers/nvme/target/io-cmd-file.c:365:2: note: Loop condition is true.  
Entering loop body
           for (id = 0 ; id < nr_range; id++) {
           ^
   drivers/nvme/target/io-cmd-file.c:370:7: note: Assuming 'ret' is not equal 
to 0
                   if (ret)
                       ^~~
   drivers/nvme/target/io-cmd-file.c:370:3: note: Taking true branch
                   if (ret)
                   ^
   drivers/nvme/target/io-cmd-file.c:371:4: note: Control jumps to line 377
                           goto out;
                           ^
   drivers/nvme/target/io-cmd-file.c:377:11: note: The right operand of '!=' is 
a garbage value
                   if (ret != len) {
                           ^  ~~~
>> drivers/nvme/target/io-cmd-file.c:378:4: warning: Value stored to 'pos' is 
>> never read [clang-analyzer-deadcode.DeadStores]
                           pos += ret;
                           ^      ~~~
   drivers/nvme/target/io-cmd-file.c:378:4: note: Value stored to 'pos' is 
never read
                           pos += ret;
                           ^      ~~~
   Suppressed 10 warnings (3 in non-user code, 7 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.
   10 warnings generated.
   Suppressed 10 warnings (3 in non-user code, 7 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.
   9 warnings generated.
   Suppressed 9 warnings (2 in non-user code, 7 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.
   9 warnings generated.
   Suppressed 9 warnings (2 in non-user code, 7 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.
   9 warnings generated.
   Suppressed 9 warnings (2 in non-user code, 7 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.
   9 warnings generated.
   Suppressed 9 warnings (2 in non-user code, 7 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.
   9 warnings generated.
   Suppressed 9 warnings (2 in non-user code, 7 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.
   9 warnings generated.
   Suppressed 9 warnings (2 in non-user code, 7 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.
   10 warnings generated.
   drivers/input/keyboard/lm8323.c:333:3: warning: Value stored to 'active' is 
never read [clang-analyzer-deadcode.DeadStores]
                   active = debounce + 3;
                   ^        ~~~~~~~~~~~~
   drivers/input/keyboard/lm8323.c:333:3: note: Value stored to 'active' is 
never read
                   active = debounce + 3;
                   ^        ~~~~~~~~~~~~
   Suppressed 9 warnings (2 in non-user code, 7 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.
   9 warnings generated.
   Suppressed 9 warnings (2 in non-user code, 7 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.
   9 warnings generated.
   Suppressed 9 warnings (2 in non-user code, 7 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.
   9 warnings generated.
   Suppressed 9 warnings (2 in non-user code, 7 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.
   9 warnings generated.
   Suppressed 9 warnings (2 in non-user code, 7 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.
   9 warnings generated.
   Suppressed 9 warnings (2 in non-user code, 7 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.
   9 warnings generated.
   Suppressed 9 warnings (2 in non-user code, 7 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.
   9 warnings generated.
   Suppressed 9 warnings (2 in non-user code, 7 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.
   9 warnings generated.
   Suppressed 9 warnings (2 in non-user code, 7 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.
   9 warnings generated.
   Suppressed 9 warnings (2 in non-user code, 7 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.
   9 warnings generated.
   Suppressed 9 warnings (2 in non-user code, 7 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.
   9 warnings generated.
   Suppressed 9 warnings (2 in non-user code, 7 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.
   9 warnings generated.
   Suppressed 9 warnings (2 in non-user code, 7 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.
   9 warnings generated.
   Suppressed 9 warnings (2 in non-user code, 7 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.
   net/ipv6/ip6_vti.c:194: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(t->parms.name, dev->name);
           ^~~~~~
   net/ipv6/ip6_vti.c:194: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(t->parms.name, dev->name);
           ^~~~~~
   net/ipv6/ip6_vti.c:853:4: warning: Value stored to 'err' is never read 
[clang-analyzer-deadcode.DeadStores]
                           err = vti6_update(t, &p1, false);
                           ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/ipv6/ip6_vti.c:853:4: note: Value stored to 'err' is never read
                           err = vti6_update(t, &p1, false);
                           ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/ipv6/ip6_vti.c:1170: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(t->parms.name, ip6n->fb_tnl_dev->name);
           ^~~~~~
   net/ipv6/ip6_vti.c:1170: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(t->parms.name, ip6n->fb_tnl_dev->name);
           ^~~~~~
   net/ipv6/ip6_vti.c:1296:2: warning: Value stored to 'err' is never read 
[clang-analyzer-deadcode.DeadStores]
           err = xfrm6_tunnel_deregister(&vti_ip6ip_handler, AF_INET);
           ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/ipv6/ip6_vti.c:1296:2: note: Value stored to 'err' is never read
           err = xfrm6_tunnel_deregister(&vti_ip6ip_handler, AF_INET);

vim +/pos +378 drivers/nvme/target/io-cmd-file.c

d5eff33ee6f808 Chaitanya Kulkarni 2018-05-23  349  
6bb6ea64499e1a Arnav Dawn         2022-02-07  350  static void 
nvmet_file_copy_work(struct work_struct *w)
6bb6ea64499e1a Arnav Dawn         2022-02-07  351  {
6bb6ea64499e1a Arnav Dawn         2022-02-07  352       struct nvmet_req *req = 
container_of(w, struct nvmet_req, f.work);
6bb6ea64499e1a Arnav Dawn         2022-02-07  353       int nr_range;
6bb6ea64499e1a Arnav Dawn         2022-02-07  354       loff_t pos;
6bb6ea64499e1a Arnav Dawn         2022-02-07  355       struct nvme_command 
*cmnd = req->cmd;
6bb6ea64499e1a Arnav Dawn         2022-02-07  356       int ret = 0, len, src, 
id;
6bb6ea64499e1a Arnav Dawn         2022-02-07  357  
6bb6ea64499e1a Arnav Dawn         2022-02-07  358       nr_range = 
cmnd->copy.nr_range + 1;
6bb6ea64499e1a Arnav Dawn         2022-02-07  359       pos = 
le64_to_cpu(req->cmd->copy.sdlba) << req->ns->blksize_shift;
6bb6ea64499e1a Arnav Dawn         2022-02-07  360       if (unlikely(pos + 
req->transfer_len > req->ns->size)) {
6bb6ea64499e1a Arnav Dawn         2022-02-07  361               
nvmet_req_complete(req, errno_to_nvme_status(req, -ENOSPC));
6bb6ea64499e1a Arnav Dawn         2022-02-07  362               return;
6bb6ea64499e1a Arnav Dawn         2022-02-07  363       }
6bb6ea64499e1a Arnav Dawn         2022-02-07  364  
6bb6ea64499e1a Arnav Dawn         2022-02-07  365       for (id = 0 ; id < 
nr_range; id++) {
6bb6ea64499e1a Arnav Dawn         2022-02-07  366               struct 
nvme_copy_range range;
6bb6ea64499e1a Arnav Dawn         2022-02-07  367  
6bb6ea64499e1a Arnav Dawn         2022-02-07  368               ret = 
nvmet_copy_from_sgl(req, id * sizeof(range), &range,
6bb6ea64499e1a Arnav Dawn         2022-02-07  369                               
        sizeof(range));
6bb6ea64499e1a Arnav Dawn         2022-02-07  370               if (ret)
6bb6ea64499e1a Arnav Dawn         2022-02-07  371                       goto 
out;
6bb6ea64499e1a Arnav Dawn         2022-02-07  372  
6bb6ea64499e1a Arnav Dawn         2022-02-07  373               len = 
(le16_to_cpu(range.nlb) + 1) << (req->ns->blksize_shift);
6bb6ea64499e1a Arnav Dawn         2022-02-07  374               src = 
(le64_to_cpu(range.slba) << (req->ns->blksize_shift));
6bb6ea64499e1a Arnav Dawn         2022-02-07  375               ret = 
vfs_copy_file_range(req->ns->file, src, req->ns->file, pos, len, 0);
6bb6ea64499e1a Arnav Dawn         2022-02-07  376  out:
6bb6ea64499e1a Arnav Dawn         2022-02-07  377               if (ret != len) 
{
6bb6ea64499e1a Arnav Dawn         2022-02-07 @378                       pos += 
ret;
6bb6ea64499e1a Arnav Dawn         2022-02-07  379                       
req->cqe->result.u32 = cpu_to_le32(id);
6bb6ea64499e1a Arnav Dawn         2022-02-07  380                       
nvmet_req_complete(req, ret < 0 ? errno_to_nvme_status(req, ret) :
6bb6ea64499e1a Arnav Dawn         2022-02-07  381                               
        errno_to_nvme_status(req, -EIO));
6bb6ea64499e1a Arnav Dawn         2022-02-07  382                       return;
6bb6ea64499e1a Arnav Dawn         2022-02-07  383  
6bb6ea64499e1a Arnav Dawn         2022-02-07  384               } else
6bb6ea64499e1a Arnav Dawn         2022-02-07  385                       pos += 
len;
6bb6ea64499e1a Arnav Dawn         2022-02-07  386  }
6bb6ea64499e1a Arnav Dawn         2022-02-07  387       nvmet_req_complete(req, 
ret);
6bb6ea64499e1a Arnav Dawn         2022-02-07  388  

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

Reply via email to