:::::: 
:::::: Manual check reason: "low confidence static check warning: 
mm/madvise.c:1174:66: warning: Parameter 'task' can be declared with const 
[constParameter]"
:::::: 

CC: [email protected]
BCC: [email protected]
CC: Linux Memory Management List <[email protected]>
TO: "Zach O'Keefe" <[email protected]>
CC: Andrew Morton <[email protected]>
CC: Linux Memory Management List <[email protected]>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git 
master
head:   4662b7adea50bb62e993a67f611f3be625d3df0d
commit: 5e4507b87649326c597b9804979705c8269ed0b4 [9612/10347] mm/madvise: add 
MADV_COLLAPSE to process_madvise()
:::::: branch date: 8 hours ago
:::::: commit date: 2 days ago
compiler: powerpc-linux-gcc (GCC) 11.3.0
reproduce (cppcheck warning):
        # apt-get install cppcheck
        git checkout 5e4507b87649326c597b9804979705c8269ed0b4
        cppcheck --quiet --enable=style,performance,portability --template=gcc 
FILE

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <[email protected]>


cppcheck possible warnings: (new ones prefixed by >>, may not real problems)

   mm/madvise.c:1492:6: warning: Redundant assignment of 'ret' to itself. 
[selfAssignment]
    ret = (total_len - iov_iter_count(&iter)) ? : ret;
        ^
   mm/madvise.c:126:28: warning: Parameter 'anon_name' can be declared with 
const [constParameter]
        struct anon_vma_name *anon_name)
                              ^
>> mm/madvise.c:1174:66: warning: Parameter 'task' can be declared with const 
>> [constParameter]
   process_madvise_behavior_valid(int behavior, struct task_struct *task)
                                                                    ^

vim +/task +1174 mm/madvise.c

3866ea90d3635d Hugh Dickins 2009-09-21  1172  
ecb8ac8b1f1469 Minchan Kim  2020-10-17  1173  static bool
5e4507b8764932 Zach O'Keefe 2022-07-06 @1174  
process_madvise_behavior_valid(int behavior, struct task_struct *task)
ecb8ac8b1f1469 Minchan Kim  2020-10-17  1175  {
ecb8ac8b1f1469 Minchan Kim  2020-10-17  1176    switch (behavior) {
ecb8ac8b1f1469 Minchan Kim  2020-10-17  1177    case MADV_COLD:
ecb8ac8b1f1469 Minchan Kim  2020-10-17  1178    case MADV_PAGEOUT:
d5fffc5aff2697 zhangkui     2021-09-02  1179    case MADV_WILLNEED:
ecb8ac8b1f1469 Minchan Kim  2020-10-17  1180            return true;
5e4507b8764932 Zach O'Keefe 2022-07-06  1181    case MADV_COLLAPSE:
5e4507b8764932 Zach O'Keefe 2022-07-06  1182            return task == current 
|| capable(CAP_SYS_ADMIN);
ecb8ac8b1f1469 Minchan Kim  2020-10-17  1183    default:
ecb8ac8b1f1469 Minchan Kim  2020-10-17  1184            return false;
ecb8ac8b1f1469 Minchan Kim  2020-10-17  1185    }
ecb8ac8b1f1469 Minchan Kim  2020-10-17  1186  }
ecb8ac8b1f1469 Minchan Kim  2020-10-17  1187  

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

Reply via email to