CC: [email protected]
CC: [email protected]
CC: [email protected]
TO: Andrey Konovalov <[email protected]>
CC: Marco Elver <[email protected]>
CC: Alexander Potapenko <[email protected]>
CC: Andrew Morton <[email protected]>
CC: Linux Memory Management List <[email protected]>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   b81b1829e7e39f6cebdf6e4d5484eacbceda8554
commit: 858bdeb046f6dc7a79039d577d03e4d2b39272b7 kasan: add proper page 
allocator tests
date:   12 months ago
:::::: branch date: 10 hours ago
:::::: commit date: 12 months ago
config: riscv-randconfig-c006-20220213 
(https://download.01.org/0day-ci/archive/20220213/[email protected]/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 
c7eb84634519e6497be42f5fe323f9a04ed67127)
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/torvalds/linux.git/commit/?id=858bdeb046f6dc7a79039d577d03e4d2b39272b7
        git remote add linus 
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout 858bdeb046f6dc7a79039d577d03e4d2b39272b7
        # 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 >>)
   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.
   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.
   4 warnings generated.
   Suppressed 4 warnings (4 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.
   Suppressed 4 warnings (4 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.
   Suppressed 4 warnings (4 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.
   Suppressed 4 warnings (4 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.
   Suppressed 4 warnings (4 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.
   Suppressed 4 warnings (4 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.
   lib/string_helpers.c:111:12: warning: Assigned value is garbage or undefined 
[clang-analyzer-core.uninitialized.Assign]
           remainder += rounding[j];
                     ^  ~~~~~~~~~~~
   lib/string_helpers.c:59:6: note: Assuming 'blk_size' is not equal to 0
           if (blk_size == 0)
               ^~~~~~~~~~~~~
   lib/string_helpers.c:59:2: note: Taking false branch
           if (blk_size == 0)
           ^
   lib/string_helpers.c:61:6: note: Assuming 'size' is not equal to 0
           if (size == 0)
               ^~~~~~~~~
   lib/string_helpers.c:61:2: note: Taking false branch
           if (size == 0)
           ^
   lib/string_helpers.c:75:2: note: Loop condition is false. Execution 
continues on line 80
           while (blk_size >> 32) {
           ^
   lib/string_helpers.c:80:2: note: Loop condition is false. Execution 
continues on line 87
           while (size >> 32) {
           ^
   lib/string_helpers.c:90:2: note: Loop condition is false. Execution 
continues on line 97
           while (size >= divisor[units]) {
           ^
   lib/string_helpers.c:98:14: note: Assuming the condition is true
           for (j = 0; sf_cap*10 < 1000; j++)
                       ^~~~~~~~~~~~~~~~
   lib/string_helpers.c:98:2: note: Loop condition is true.  Entering loop body
           for (j = 0; sf_cap*10 < 1000; j++)
           ^
   lib/string_helpers.c:98:14: note: Assuming the condition is true
           for (j = 0; sf_cap*10 < 1000; j++)
                       ^~~~~~~~~~~~~~~~
   lib/string_helpers.c:98:2: note: Loop condition is true.  Entering loop body
           for (j = 0; sf_cap*10 < 1000; j++)
           ^
   lib/string_helpers.c:98:14: note: Assuming the condition is true
           for (j = 0; sf_cap*10 < 1000; j++)
                       ^~~~~~~~~~~~~~~~
   lib/string_helpers.c:98:2: note: Loop condition is true.  Entering loop body
           for (j = 0; sf_cap*10 < 1000; j++)
           ^
   lib/string_helpers.c:98:32: note: The value 3 is assigned to 'j'
           for (j = 0; sf_cap*10 < 1000; j++)
                                         ^~~
   lib/string_helpers.c:98:14: note: Assuming the condition is false
           for (j = 0; sf_cap*10 < 1000; j++)
                       ^~~~~~~~~~~~~~~~
   lib/string_helpers.c:98:2: note: Loop condition is false. Execution 
continues on line 101
           for (j = 0; sf_cap*10 < 1000; j++)
           ^
   lib/string_helpers.c:101:6: note: Assuming 'units' is not equal to 
STRING_UNITS_2
           if (units == STRING_UNITS_2) {
               ^~~~~~~~~~~~~~~~~~~~~~~
   lib/string_helpers.c:101:2: note: Taking false branch
           if (units == STRING_UNITS_2) {
           ^
   lib/string_helpers.c:111:12: note: Assigned value is garbage or undefined
           remainder += rounding[j];
                     ^  ~~~~~~~~~~~
   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.
   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.
   4 warnings generated.
   Suppressed 4 warnings (4 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.
   15 warnings generated.
>> lib/test_kasan.c:203:9: warning: Value stored to 'size' during its 
>> initialization is never read [clang-analyzer-deadcode.DeadStores]
           size_t size = (1UL << (PAGE_SHIFT + order));
                  ^~~~   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   lib/test_kasan.c:203:9: note: Value stored to 'size' during its 
initialization is never read
           size_t size = (1UL << (PAGE_SHIFT + order));
                  ^~~~   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   lib/test_kasan.c:315:40: warning: Use of memory after it is freed 
[clang-analyzer-unix.Malloc]
           KUNIT_EXPECT_KASAN_FAIL(test, *ptr1 = *ptr2);
                                                 ^
   lib/test_kasan.c:88:2: note: expanded from macro 'KUNIT_EXPECT_KASAN_FAIL'
           expression;                                             \
           ^~~~~~~~~~
   lib/test_kasan.c:309:2: note: Loop condition is false.  Exiting loop
           KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ptr1);
           ^
   include/kunit/test.h:1766:2: note: expanded from macro 
'KUNIT_ASSERT_NOT_ERR_OR_NULL'
           KUNIT_PTR_NOT_ERR_OR_NULL_ASSERTION(test, KUNIT_ASSERTION, ptr)
           ^
   include/kunit/test.h:1207:2: note: expanded from macro 
'KUNIT_PTR_NOT_ERR_OR_NULL_ASSERTION'
           KUNIT_PTR_NOT_ERR_OR_NULL_MSG_ASSERTION(test,                        
  \
           ^
   include/kunit/test.h:1195:2: note: expanded from macro 
'KUNIT_PTR_NOT_ERR_OR_NULL_MSG_ASSERTION'
           KUNIT_ASSERTION(test,                                                
  \
           ^
   include/kunit/test.h:679:74: note: expanded from macro 'KUNIT_ASSERTION'
   #define KUNIT_ASSERTION(test, pass, assert_class, INITIALIZER, fmt, ...) do 
{  \
                                                                            ^
   lib/test_kasan.c:309:2: note: Loop condition is false.  Exiting loop
           KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ptr1);
           ^
   include/kunit/test.h:1766:2: note: expanded from macro 
'KUNIT_ASSERT_NOT_ERR_OR_NULL'
           KUNIT_PTR_NOT_ERR_OR_NULL_ASSERTION(test, KUNIT_ASSERTION, ptr)
           ^
   include/kunit/test.h:1207:2: note: expanded from macro 
'KUNIT_PTR_NOT_ERR_OR_NULL_ASSERTION'
           KUNIT_PTR_NOT_ERR_OR_NULL_MSG_ASSERTION(test,                        
  \
           ^
   include/kunit/test.h:1191:21: note: expanded from macro 
'KUNIT_PTR_NOT_ERR_OR_NULL_MSG_ASSERTION'
                                                   ...)                         
  \
                                                                                
  ^
   lib/test_kasan.c:312:2: note: Calling 'IS_ERR_OR_NULL'
           KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ptr2);
           ^
   include/kunit/test.h:1766:2: note: expanded from macro 
'KUNIT_ASSERT_NOT_ERR_OR_NULL'
           KUNIT_PTR_NOT_ERR_OR_NULL_ASSERTION(test, KUNIT_ASSERTION, ptr)
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/kunit/test.h:1207:2: note: expanded from macro 
'KUNIT_PTR_NOT_ERR_OR_NULL_ASSERTION'
           KUNIT_PTR_NOT_ERR_OR_NULL_MSG_ASSERTION(test,                        
  \
           
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/kunit/test.h:1196:5: note: expanded from macro 
'KUNIT_PTR_NOT_ERR_OR_NULL_MSG_ASSERTION'
                           !IS_ERR_OR_NULL(__ptr),                              
  \
                            ^~~~~~~~~~~~~~~~~~~~~
   include/kunit/test.h:683:7: note: expanded from macro 'KUNIT_ASSERTION'
                              pass,                                             
  \
                              ^~~~
   include/linux/err.h:41:18: note: Assuming 'ptr' is non-null
           return unlikely(!ptr) || IS_ERR_VALUE((unsigned long)ptr);
                           ^
   include/linux/compiler.h:78:42: note: expanded from macro 'unlikely'
   # define unlikely(x)    __builtin_expect(!!(x), 0)
                                               ^
   include/linux/err.h:41:9: note: Left side of '||' is false
           return unlikely(!ptr) || IS_ERR_VALUE((unsigned long)ptr);
                  ^
   include/linux/compiler.h:78:22: note: expanded from macro 'unlikely'
   # define unlikely(x)    __builtin_expect(!!(x), 0)
                           ^
   include/linux/err.h:41:27: note: Assuming the condition is false
           return unlikely(!ptr) || IS_ERR_VALUE((unsigned long)ptr);
                                    ^
   include/linux/err.h:22:34: note: expanded from macro 'IS_ERR_VALUE'
   #define IS_ERR_VALUE(x) unlikely((unsigned long)(void *)(x) >= (unsigned 
long)-MAX_ERRNO)
                           
~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/compiler.h:78:42: note: expanded from macro 'unlikely'
   # define unlikely(x)    __builtin_expect(!!(x), 0)
                                               ^
   lib/test_kasan.c:312:2: note: Returning from 'IS_ERR_OR_NULL'
           KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ptr2);
           ^
   include/kunit/test.h:1766:2: note: expanded from macro 
'KUNIT_ASSERT_NOT_ERR_OR_NULL'
           KUNIT_PTR_NOT_ERR_OR_NULL_ASSERTION(test, KUNIT_ASSERTION, ptr)
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/kunit/test.h:1207:2: note: expanded from macro 
'KUNIT_PTR_NOT_ERR_OR_NULL_ASSERTION'
           KUNIT_PTR_NOT_ERR_OR_NULL_MSG_ASSERTION(test,                        
  \
           
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/kunit/test.h:1196:5: note: expanded from macro 
'KUNIT_PTR_NOT_ERR_OR_NULL_MSG_ASSERTION'
                           !IS_ERR_OR_NULL(__ptr),                              
  \
                            ^~~~~~~~~~~~~~~~~~~~~
   include/kunit/test.h:683:7: note: expanded from macro 'KUNIT_ASSERTION'
                              pass,                                             
  \
                              ^~~~
   lib/test_kasan.c:312:2: note: Loop condition is false.  Exiting loop
           KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ptr2);
           ^
   include/kunit/test.h:1766:2: note: expanded from macro 
'KUNIT_ASSERT_NOT_ERR_OR_NULL'
           KUNIT_PTR_NOT_ERR_OR_NULL_ASSERTION(test, KUNIT_ASSERTION, ptr)
           ^
   include/kunit/test.h:1207:2: note: expanded from macro 
'KUNIT_PTR_NOT_ERR_OR_NULL_ASSERTION'
           KUNIT_PTR_NOT_ERR_OR_NULL_MSG_ASSERTION(test,                        
  \
           ^
   include/kunit/test.h:1195:2: note: expanded from macro 
'KUNIT_PTR_NOT_ERR_OR_NULL_MSG_ASSERTION'
           KUNIT_ASSERTION(test,                                                
  \

vim +/size +203 lib/test_kasan.c

e6e8379c876de1 Alexander Potapenko 2016-03-25  197  
858bdeb046f6dc Andrey Konovalov    2021-02-24  198  static void 
pagealloc_oob_right(struct kunit *test)
858bdeb046f6dc Andrey Konovalov    2021-02-24  199  {
858bdeb046f6dc Andrey Konovalov    2021-02-24  200      char *ptr;
858bdeb046f6dc Andrey Konovalov    2021-02-24  201      struct page *pages;
858bdeb046f6dc Andrey Konovalov    2021-02-24  202      size_t order = 4;
858bdeb046f6dc Andrey Konovalov    2021-02-24 @203      size_t size = (1UL << 
(PAGE_SHIFT + order));
858bdeb046f6dc Andrey Konovalov    2021-02-24  204  
858bdeb046f6dc Andrey Konovalov    2021-02-24  205      /*
858bdeb046f6dc Andrey Konovalov    2021-02-24  206       * With generic KASAN 
page allocations have no redzones, thus
858bdeb046f6dc Andrey Konovalov    2021-02-24  207       * out-of-bounds 
detection is not guaranteed.
858bdeb046f6dc Andrey Konovalov    2021-02-24  208       * See 
https://bugzilla.kernel.org/show_bug.cgi?id=210503.
858bdeb046f6dc Andrey Konovalov    2021-02-24  209       */
858bdeb046f6dc Andrey Konovalov    2021-02-24  210      
KASAN_TEST_NEEDS_CONFIG_OFF(test, CONFIG_KASAN_GENERIC);
858bdeb046f6dc Andrey Konovalov    2021-02-24  211  
858bdeb046f6dc Andrey Konovalov    2021-02-24  212      pages = 
alloc_pages(GFP_KERNEL, order);
858bdeb046f6dc Andrey Konovalov    2021-02-24  213      ptr = 
page_address(pages);
858bdeb046f6dc Andrey Konovalov    2021-02-24  214      
KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ptr);
858bdeb046f6dc Andrey Konovalov    2021-02-24  215  
858bdeb046f6dc Andrey Konovalov    2021-02-24  216      
KUNIT_EXPECT_KASAN_FAIL(test, ptr[size] = 0);
858bdeb046f6dc Andrey Konovalov    2021-02-24  217      free_pages((unsigned 
long)ptr, order);
858bdeb046f6dc Andrey Konovalov    2021-02-24  218  }
858bdeb046f6dc Andrey Konovalov    2021-02-24  219  

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