All of lore.kernel.org
 help / color / mirror / Atom feed
* [linux-next:master 5080/5845] mm/sparse-vmemmap.c:740:17: warning: Value stored to 'next' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
@ 2022-04-23 12:24 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2022-04-23 12:24 UTC (permalink / raw)
  To: kbuild

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

CC: llvm(a)lists.linux.dev
CC: kbuild-all(a)lists.01.org
BCC: lkp(a)intel.com
CC: Linux Memory Management List <linux-mm@kvack.org>
TO: Joao Martins <joao.m.martins@oracle.com>
CC: Muchun Song <songmuchun@bytedance.com>
CC: Andrew Morton <akpm@linux-foundation.org>
CC: Linux Memory Management List <linux-mm@kvack.org>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   e7d6987e09a328d4a949701db40ef63fbb970670
commit: 7e0f4d6f220853c6b9272c90734f4e4dc30e0303 [5080/5845] mm/sparse-vmemmap: improve memory savings for compound devmaps
:::::: branch date: 30 hours ago
:::::: commit date: 3 days ago
config: x86_64-randconfig-c007 (https://download.01.org/0day-ci/archive/20220423/202204232000.mYBvdXLb-lkp(a)intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 5bd87350a5ae429baf8f373cb226a57b62f87280)
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/next/linux-next.git/commit/?id=7e0f4d6f220853c6b9272c90734f4e4dc30e0303
        git remote add linux-next https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
        git fetch --no-tags linux-next master
        git checkout 7e0f4d6f220853c6b9272c90734f4e4dc30e0303
        # save the config file
        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 <lkp@intel.com>


clang-analyzer warnings: (new ones prefixed by >>)
                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/fortify-string.h:265:2: note: expanded from macro '__fortify_memset_chk'
           __underlying_memset(p, c, __fortify_size);                      \
           ^~~~~~~~~~~~~~~~~~~
   include/linux/fortify-string.h:47:29: note: expanded from macro '__underlying_memset'
   #define __underlying_memset     __builtin_memset
                                   ^~~~~~~~~~~~~~~~
   fs/gfs2/glock.c:2414:3: warning: Call to function 'sprintf' is insecure as it does not provide bounding of the memory buffer or security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'sprintf_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling]
                   sprintf(fs_id_buf, "fsid=%s: ", sdp->sd_fsname);
                   ^~~~~~~
   fs/gfs2/glock.c:2414:3: note: Call to function 'sprintf' is insecure as it does not provide bounding of the memory buffer or security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'sprintf_s' in case of C11
                   sprintf(fs_id_buf, "fsid=%s: ", sdp->sd_fsname);
                   ^~~~~~~
   include/linux/jhash.h:127:5: warning: Assigned value is garbage or undefined [clang-analyzer-core.uninitialized.Assign]
                   b += k[1];
                     ^
   fs/gfs2/glock.c:1747:10: note: Calling 'gfs2_glock_get'
           error = gfs2_glock_get(sdp, number, glops, CREATE, &gl);
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/gfs2/glock.c:1165:7: note: Calling 'find_insert_glock'
           gl = find_insert_glock(&name, NULL);
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/gfs2/glock.c:1109:26: note: Calling 'glock_waitqueue'
           wait_queue_head_t *wq = glock_waitqueue(name);
                                   ^~~~~~~~~~~~~~~~~~~~~
   fs/gfs2/glock.c:108:13: note: Calling 'jhash2'
           u32 hash = jhash2((u32 *)name, ht_parms.key_len / 4, 0);
                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/jhash.h:125:2: note: Loop condition is true.  Entering loop body
           while (length > 3) {
           ^
   include/linux/jhash.h:127:5: note: Assigned value is garbage or undefined
                   b += k[1];
                     ^  ~~~~
   Suppressed 50 warnings (50 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.
   47 warnings generated.
   mm/backing-dev.c:293:2: warning: Call to function 'memset' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memset_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling]
           memset(wb, 0, sizeof(*wb));
           ^
   include/linux/fortify-string.h:272:25: note: expanded from macro 'memset'
   #define memset(p, c, s) __fortify_memset_chk(p, c, s,                   \
                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/fortify-string.h:265:2: note: expanded from macro '__fortify_memset_chk'
           __underlying_memset(p, c, __fortify_size);                      \
           ^~~~~~~~~~~~~~~~~~~
   include/linux/fortify-string.h:47:29: note: expanded from macro '__underlying_memset'
   #define __underlying_memset     __builtin_memset
                                   ^~~~~~~~~~~~~~~~
   mm/backing-dev.c:293:2: note: Call to function 'memset' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memset_s' in case of C11
           memset(wb, 0, sizeof(*wb));
           ^
   include/linux/fortify-string.h:272:25: note: expanded from macro 'memset'
   #define memset(p, c, s) __fortify_memset_chk(p, c, s,                   \
                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/fortify-string.h:265:2: note: expanded from macro '__fortify_memset_chk'
           __underlying_memset(p, c, __fortify_size);                      \
           ^~~~~~~~~~~~~~~~~~~
   include/linux/fortify-string.h:47:29: note: expanded from macro '__underlying_memset'
   #define __underlying_memset     __builtin_memset
                                   ^~~~~~~~~~~~~~~~
   mm/backing-dev.c:880:2: warning: Call to function 'vsnprintf' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'vsnprintf_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling]
           vsnprintf(bdi->dev_name, sizeof(bdi->dev_name), fmt, args);
           ^~~~~~~~~
   mm/backing-dev.c:880:2: note: Call to function 'vsnprintf' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'vsnprintf_s' in case of C11
           vsnprintf(bdi->dev_name, sizeof(bdi->dev_name), fmt, args);
           ^~~~~~~~~
   Suppressed 45 warnings (45 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.
   44 warnings generated.
   Suppressed 44 warnings (44 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.
   45 warnings generated.
   Suppressed 45 warnings (44 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.
   46 warnings generated.
   mm/sparse-vmemmap.c:573:2: warning: Call to function 'memset' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memset_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling]
           memset(p, 0, size);
           ^
   include/linux/fortify-string.h:272:25: note: expanded from macro 'memset'
   #define memset(p, c, s) __fortify_memset_chk(p, c, s,                   \
                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/fortify-string.h:265:2: note: expanded from macro '__fortify_memset_chk'
           __underlying_memset(p, c, __fortify_size);                      \
           ^~~~~~~~~~~~~~~~~~~
   include/linux/fortify-string.h:47:29: note: expanded from macro '__underlying_memset'
   #define __underlying_memset     __builtin_memset
                                   ^~~~~~~~~~~~~~~~
   mm/sparse-vmemmap.c:573:2: note: Call to function 'memset' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memset_s' in case of C11
           memset(p, 0, size);
           ^
   include/linux/fortify-string.h:272:25: note: expanded from macro 'memset'
   #define memset(p, c, s) __fortify_memset_chk(p, c, s,                   \
                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/fortify-string.h:265:2: note: expanded from macro '__fortify_memset_chk'
           __underlying_memset(p, c, __fortify_size);                      \
           ^~~~~~~~~~~~~~~~~~~
   include/linux/fortify-string.h:47:29: note: expanded from macro '__underlying_memset'
   #define __underlying_memset     __builtin_memset
                                   ^~~~~~~~~~~~~~~~
>> mm/sparse-vmemmap.c:740:17: warning: Value stored to 'next' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
                   unsigned long next = addr, last = addr + size;
                                 ^~~~   ~~~~
   mm/sparse-vmemmap.c:740:17: note: Value stored to 'next' during its initialization is never read
                   unsigned long next = addr, last = addr + size;
                                 ^~~~   ~~~~
   Suppressed 44 warnings (44 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.
   36 warnings generated.
   Suppressed 36 warnings (36 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.
   18 warnings generated.
   Suppressed 18 warnings (18 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.
   24 warnings generated.
   Suppressed 24 warnings (24 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.
   24 warnings generated.
   Suppressed 24 warnings (24 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.
   54 warnings generated.
   drivers/clk/clk.c:1972:3: warning: Value stored to 'best_parent_rate' is never read [clang-analyzer-deadcode.DeadStores]
                   best_parent_rate = parent->rate;
                   ^                  ~~~~~~~~~~~~
   drivers/clk/clk.c:1972:3: note: Value stored to 'best_parent_rate' is never read
                   best_parent_rate = parent->rate;
                   ^                  ~~~~~~~~~~~~
   drivers/clk/clk.c:2793:3: warning: Call to function 'memcpy' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memcpy_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling]
                   memcpy(&core->duty, &core->parent->duty, sizeof(core->duty));
                   ^
   include/linux/fortify-string.h:369:26: note: expanded from macro 'memcpy'
   #define memcpy(p, q, s)  __fortify_memcpy_chk(p, q, s,                  \
                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/fortify-string.h:362:2: note: expanded from macro '__fortify_memcpy_chk'
           __underlying_##op(p, q, __fortify_size);                        \
           ^~~~~~~~~~~~~~~~~
   note: expanded from here
   include/linux/fortify-string.h:45:29: note: expanded from macro '__underlying_memcpy'
   #define __underlying_memcpy     __builtin_memcpy
                                   ^~~~~~~~~~~~~~~~
   drivers/clk/clk.c:2793:3: note: Call to function 'memcpy' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memcpy_s' in case of C11
                   memcpy(&core->duty, &core->parent->duty, sizeof(core->duty));
                   ^
   include/linux/fortify-string.h:369:26: note: expanded from macro 'memcpy'
   #define memcpy(p, q, s)  __fortify_memcpy_chk(p, q, s,                  \
                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/fortify-string.h:362:2: note: expanded from macro '__fortify_memcpy_chk'
           __underlying_##op(p, q, __fortify_size);                        \
           ^~~~~~~~~~~~~~~~~
   note: expanded from here
   include/linux/fortify-string.h:45:29: note: expanded from macro '__underlying_memcpy'
   #define __underlying_memcpy     __builtin_memcpy
                                   ^~~~~~~~~~~~~~~~
   drivers/clk/clk.c:2821:3: warning: Call to function 'memcpy' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memcpy_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling]
                   memcpy(&core->duty, duty, sizeof(*duty));
                   ^
   include/linux/fortify-string.h:369:26: note: expanded from macro 'memcpy'
   #define memcpy(p, q, s)  __fortify_memcpy_chk(p, q, s,                  \
                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/fortify-string.h:362:2: note: expanded from macro '__fortify_memcpy_chk'
           __underlying_##op(p, q, __fortify_size);                        \
           ^~~~~~~~~~~~~~~~~
   note: expanded from here
   include/linux/fortify-string.h:45:29: note: expanded from macro '__underlying_memcpy'
   #define __underlying_memcpy     __builtin_memcpy
                                   ^~~~~~~~~~~~~~~~
   drivers/clk/clk.c:2821:3: note: Call to function 'memcpy' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memcpy_s' in case of C11
                   memcpy(&core->duty, duty, sizeof(*duty));
                   ^
   include/linux/fortify-string.h:369:26: note: expanded from macro 'memcpy'
   #define memcpy(p, q, s)  __fortify_memcpy_chk(p, q, s,                  \
                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/fortify-string.h:362:2: note: expanded from macro '__fortify_memcpy_chk'
           __underlying_##op(p, q, __fortify_size);                        \
           ^~~~~~~~~~~~~~~~~
   note: expanded from here
   include/linux/fortify-string.h:45:29: note: expanded from macro '__underlying_memcpy'
   #define __underlying_memcpy     __builtin_memcpy
                                   ^~~~~~~~~~~~~~~~
   drivers/clk/clk.c:2836:3: warning: Call to function 'memcpy' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memcpy_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling]
                   memcpy(&core->duty, &core->parent->duty, sizeof(core->duty));
                   ^
   include/linux/fortify-string.h:369:26: note: expanded from macro 'memcpy'
   #define memcpy(p, q, s)  __fortify_memcpy_chk(p, q, s,                  \
                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/fortify-string.h:362:2: note: expanded from macro '__fortify_memcpy_chk'
           __underlying_##op(p, q, __fortify_size);                        \
           ^~~~~~~~~~~~~~~~~
   note: expanded from here
   include/linux/fortify-string.h:45:29: note: expanded from macro '__underlying_memcpy'
   #define __underlying_memcpy     __builtin_memcpy
                                   ^~~~~~~~~~~~~~~~
   drivers/clk/clk.c:2836:3: note: Call to function 'memcpy' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memcpy_s' in case of C11
                   memcpy(&core->duty, &core->parent->duty, sizeof(core->duty));
                   ^
   include/linux/fortify-string.h:369:26: note: expanded from macro 'memcpy'
   #define memcpy(p, q, s)  __fortify_memcpy_chk(p, q, s,                  \
                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/fortify-string.h:362:2: note: expanded from macro '__fortify_memcpy_chk'
           __underlying_##op(p, q, __fortify_size);                        \
           ^~~~~~~~~~~~~~~~~

vim +/next +740 mm/sparse-vmemmap.c

7e0f4d6f220853 Joao Martins 2022-04-21  715  
7e0f4d6f220853 Joao Martins 2022-04-21  716  static int __meminit vmemmap_populate_compound_pages(unsigned long start_pfn,
7e0f4d6f220853 Joao Martins 2022-04-21  717  						     unsigned long start,
7e0f4d6f220853 Joao Martins 2022-04-21  718  						     unsigned long end, int node,
7e0f4d6f220853 Joao Martins 2022-04-21  719  						     struct dev_pagemap *pgmap)
7e0f4d6f220853 Joao Martins 2022-04-21  720  {
7e0f4d6f220853 Joao Martins 2022-04-21  721  	unsigned long size, addr;
7e0f4d6f220853 Joao Martins 2022-04-21  722  	pte_t *pte;
7e0f4d6f220853 Joao Martins 2022-04-21  723  	int rc;
7e0f4d6f220853 Joao Martins 2022-04-21  724  
7e0f4d6f220853 Joao Martins 2022-04-21  725  	if (reuse_compound_section(start_pfn, pgmap)) {
7e0f4d6f220853 Joao Martins 2022-04-21  726  		pte = compound_section_tail_page(start);
7e0f4d6f220853 Joao Martins 2022-04-21  727  		if (!pte)
7e0f4d6f220853 Joao Martins 2022-04-21  728  			return -ENOMEM;
7e0f4d6f220853 Joao Martins 2022-04-21  729  
7e0f4d6f220853 Joao Martins 2022-04-21  730  		/*
7e0f4d6f220853 Joao Martins 2022-04-21  731  		 * Reuse the page that was populated in the prior iteration
7e0f4d6f220853 Joao Martins 2022-04-21  732  		 * with just tail struct pages.
7e0f4d6f220853 Joao Martins 2022-04-21  733  		 */
7e0f4d6f220853 Joao Martins 2022-04-21  734  		return vmemmap_populate_range(start, end, node, NULL,
7e0f4d6f220853 Joao Martins 2022-04-21  735  					      pte_page(*pte));
7e0f4d6f220853 Joao Martins 2022-04-21  736  	}
7e0f4d6f220853 Joao Martins 2022-04-21  737  
7e0f4d6f220853 Joao Martins 2022-04-21  738  	size = min(end - start, pgmap_vmemmap_nr(pgmap) * sizeof(struct page));
7e0f4d6f220853 Joao Martins 2022-04-21  739  	for (addr = start; addr < end; addr += size) {
7e0f4d6f220853 Joao Martins 2022-04-21 @740  		unsigned long next = addr, last = addr + size;
7e0f4d6f220853 Joao Martins 2022-04-21  741  
7e0f4d6f220853 Joao Martins 2022-04-21  742  		/* Populate the head page vmemmap page */
7e0f4d6f220853 Joao Martins 2022-04-21  743  		pte = vmemmap_populate_address(addr, node, NULL, NULL);
7e0f4d6f220853 Joao Martins 2022-04-21  744  		if (!pte)
7e0f4d6f220853 Joao Martins 2022-04-21  745  			return -ENOMEM;
7e0f4d6f220853 Joao Martins 2022-04-21  746  
7e0f4d6f220853 Joao Martins 2022-04-21  747  		/* Populate the tail pages vmemmap page */
7e0f4d6f220853 Joao Martins 2022-04-21  748  		next = addr + PAGE_SIZE;
7e0f4d6f220853 Joao Martins 2022-04-21  749  		pte = vmemmap_populate_address(next, node, NULL, NULL);
7e0f4d6f220853 Joao Martins 2022-04-21  750  		if (!pte)
7e0f4d6f220853 Joao Martins 2022-04-21  751  			return -ENOMEM;
7e0f4d6f220853 Joao Martins 2022-04-21  752  
7e0f4d6f220853 Joao Martins 2022-04-21  753  		/*
7e0f4d6f220853 Joao Martins 2022-04-21  754  		 * Reuse the previous page for the rest of tail pages
7e0f4d6f220853 Joao Martins 2022-04-21  755  		 * See layout diagram in Documentation/vm/vmemmap_dedup.rst
7e0f4d6f220853 Joao Martins 2022-04-21  756  		 */
7e0f4d6f220853 Joao Martins 2022-04-21  757  		next += PAGE_SIZE;
7e0f4d6f220853 Joao Martins 2022-04-21  758  		rc = vmemmap_populate_range(next, last, node, NULL,
7e0f4d6f220853 Joao Martins 2022-04-21  759  					    pte_page(*pte));
7e0f4d6f220853 Joao Martins 2022-04-21  760  		if (rc)
7e0f4d6f220853 Joao Martins 2022-04-21  761  			return -ENOMEM;
7e0f4d6f220853 Joao Martins 2022-04-21  762  	}
7e0f4d6f220853 Joao Martins 2022-04-21  763  
7e0f4d6f220853 Joao Martins 2022-04-21  764  	return 0;
73e8e90545569b Joao Martins 2022-04-21  765  }
73e8e90545569b Joao Martins 2022-04-21  766  

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-04-23 12:24 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-23 12:24 [linux-next:master 5080/5845] mm/sparse-vmemmap.c:740:17: warning: Value stored to 'next' during its initialization is never read [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.