CC: [email protected]
BCC: [email protected]
CC: [email protected]
TO: Kees Cook <[email protected]>
CC: Vitor Massaru Iha <[email protected]>
CC: Daniel Latypov <[email protected]>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git 
for-next/overflow
head:   2ee9b438ef95e4d1a41fba18fd837d1cea67d4a8
commit: 8c7cda57cfb9c6be06dafe8d5077483e7ded637c [4/7] lib: overflow: Convert 
to Kunit
:::::: branch date: 8 hours ago
:::::: commit date: 7 days ago
config: powerpc64-randconfig-c023-20220223 
(https://download.01.org/0day-ci/archive/20220224/[email protected]/config)
compiler: powerpc64-linux-gcc (GCC) 11.2.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email protected]>
Reported-by: Julia Lawall <[email protected]>


cocci warnings: (new ones prefixed by >>)
>> lib/overflow_kunit.c:485:13-14: WARNING: array_size is used later (line 492) 
>> to compute the same size

vim +485 lib/overflow_kunit.c

ca90800a91ba72 lib/test_overflow.c  Kees Cook 2018-05-10  469  
ca90800a91ba72 lib/test_overflow.c  Kees Cook 2018-05-10  470  #define 
DEFINE_TEST_ALLOC(func, free_func, want_arg, want_gfp, want_node)\
8c7cda57cfb9c6 lib/overflow_kunit.c Kees Cook 2022-02-16  471  static void 
test_ ## func (struct kunit *test, void *arg)                \
ca90800a91ba72 lib/test_overflow.c  Kees Cook 2018-05-10  472  {                
                                                        \
ca90800a91ba72 lib/test_overflow.c  Kees Cook 2018-05-10  473   volatile size_t 
a = TEST_SIZE;                                  \
ca90800a91ba72 lib/test_overflow.c  Kees Cook 2018-05-10  474   volatile size_t 
b = (SIZE_MAX / TEST_SIZE) + 1;                 \
ca90800a91ba72 lib/test_overflow.c  Kees Cook 2018-05-10  475   void *ptr;      
                                                \
ca90800a91ba72 lib/test_overflow.c  Kees Cook 2018-05-10  476                   
                                                \
ca90800a91ba72 lib/test_overflow.c  Kees Cook 2018-05-10  477   /* Tiny 
allocation test. */                                     \
ca90800a91ba72 lib/test_overflow.c  Kees Cook 2018-05-10  478   ptr = alloc ## 
want_arg ## want_gfp ## want_node (func, arg, 1);\
8c7cda57cfb9c6 lib/overflow_kunit.c Kees Cook 2022-02-16  479   
KUNIT_ASSERT_NOT_ERR_OR_NULL_MSG(test, ptr,                     \
8c7cda57cfb9c6 lib/overflow_kunit.c Kees Cook 2022-02-16  480                   
    #func " failed regular allocation?!\n");    \
ca90800a91ba72 lib/test_overflow.c  Kees Cook 2018-05-10  481   free ## 
want_arg (free_func, arg, ptr);                         \
ca90800a91ba72 lib/test_overflow.c  Kees Cook 2018-05-10  482                   
                                                \
ca90800a91ba72 lib/test_overflow.c  Kees Cook 2018-05-10  483   /* Wrapped 
allocation test. */                                  \
ca90800a91ba72 lib/test_overflow.c  Kees Cook 2018-05-10  484   ptr = alloc ## 
want_arg ## want_gfp ## want_node (func, arg,    \
ca90800a91ba72 lib/test_overflow.c  Kees Cook 2018-05-10 @485                   
                                  a * b);       \
8c7cda57cfb9c6 lib/overflow_kunit.c Kees Cook 2022-02-16  486   
KUNIT_ASSERT_NOT_ERR_OR_NULL_MSG(test, ptr,                     \
8c7cda57cfb9c6 lib/overflow_kunit.c Kees Cook 2022-02-16  487                   
    #func " unexpectedly failed bad wrapping?!\n"); \
ca90800a91ba72 lib/test_overflow.c  Kees Cook 2018-05-10  488   free ## 
want_arg (free_func, arg, ptr);                         \
ca90800a91ba72 lib/test_overflow.c  Kees Cook 2018-05-10  489                   
                                                \
ca90800a91ba72 lib/test_overflow.c  Kees Cook 2018-05-10  490   /* Saturated 
allocation test. */                                \
ca90800a91ba72 lib/test_overflow.c  Kees Cook 2018-05-10  491   ptr = alloc ## 
want_arg ## want_gfp ## want_node (func, arg,    \
ca90800a91ba72 lib/test_overflow.c  Kees Cook 2018-05-10 @492                   
                           array_size(a, b));   \
ca90800a91ba72 lib/test_overflow.c  Kees Cook 2018-05-10  493   if (ptr) {      
                                                \
8c7cda57cfb9c6 lib/overflow_kunit.c Kees Cook 2022-02-16  494           
KUNIT_FAIL(test, #func " missed saturation!\n");        \
ca90800a91ba72 lib/test_overflow.c  Kees Cook 2018-05-10  495           free ## 
want_arg (free_func, arg, ptr);                 \
ca90800a91ba72 lib/test_overflow.c  Kees Cook 2018-05-10  496   }               
                                                \
ca90800a91ba72 lib/test_overflow.c  Kees Cook 2018-05-10  497  }
ca90800a91ba72 lib/test_overflow.c  Kees Cook 2018-05-10  498  

:::::: The code at line 485 was first introduced by commit
:::::: ca90800a91ba723d78ded634d037c1d2df8b54d6 test_overflow: Add memory 
allocation overflow tests

:::::: TO: Kees Cook <[email protected]>
:::::: CC: Kees Cook <[email protected]>

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