:::::: 
:::::: Manual check reason: "low confidence static check warning: 
kernel/sysctl.c:317:52: warning: Parameter 'ppos' can be declared with const 
[constParameter]"
:::::: 

CC: [email protected]
BCC: [email protected]
CC: [email protected]
TO: Xiaoming Ni <[email protected]>
CC: Luis Chamberlain <[email protected]>
CC: Jan Kara <[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:   ff6992735ade75aae3e35d16b17da1008d753d28
commit: 86b12b6c5d6b46e64bf2e8080528781032e4bd90 aio: move aio sysctl to aio.c
date:   6 months ago
:::::: branch date: 15 hours ago
:::::: commit date: 6 months ago
compiler: m68k-linux-gcc (GCC) 12.1.0
reproduce (cppcheck warning):
        # apt-get install cppcheck
        git checkout 86b12b6c5d6b46e64bf2e8080528781032e4bd90
        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)

>> kernel/sysctl.c:317:52: warning: Parameter 'ppos' can be declared with const 
>> [constParameter]
   static bool proc_first_pos_non_zero_ignore(loff_t *ppos,
                                                      ^
>> kernel/sysctl.c:664:19: warning: Parameter 'lenp' can be declared with const 
>> [constParameter]
             size_t *lenp, loff_t *ppos,
                     ^
>> kernel/sysctl.c:880:41: warning: Parameter 'table' can be declared with 
>> const [constParameter]
   static int proc_taint(struct ctl_table *table, int write,
                                           ^
>> kernel/sysctl.c:961:36: warning: Uninitialized variable: tmp [uninitvar]
     if ((param->min && *param->min > tmp) ||
                                      ^
   kernel/sysctl.c:957:6: note: Assuming condition is false
    if (ret)
        ^
   kernel/sysctl.c:961:36: note: Uninitialized variable: tmp
     if ((param->min && *param->min > tmp) ||
                                      ^
   kernel/sysctl.c:1026:36: warning: Uninitialized variable: tmp [uninitvar]
     if ((param->min && *param->min > tmp) ||
                                      ^
   kernel/sysctl.c:1022:6: note: Assuming condition is false
    if (ret)
        ^
   kernel/sysctl.c:1026:36: note: Uninitialized variable: tmp
     if ((param->min && *param->min > tmp) ||
                                      ^

vim +/ppos +317 kernel/sysctl.c

f461d2dcd511c0 Christoph Hellwig 2020-04-24  307  
f461d2dcd511c0 Christoph Hellwig 2020-04-24  308  /**
f461d2dcd511c0 Christoph Hellwig 2020-04-24  309   * 
proc_first_pos_non_zero_ignore - check if first position is allowed
f461d2dcd511c0 Christoph Hellwig 2020-04-24  310   * @ppos: file position
f461d2dcd511c0 Christoph Hellwig 2020-04-24  311   * @table: the sysctl table
f461d2dcd511c0 Christoph Hellwig 2020-04-24  312   *
f461d2dcd511c0 Christoph Hellwig 2020-04-24  313   * Returns true if the first 
position is non-zero and the sysctl_writes_strict
f461d2dcd511c0 Christoph Hellwig 2020-04-24  314   * mode indicates this is not 
allowed for numeric input types. String proc
f461d2dcd511c0 Christoph Hellwig 2020-04-24  315   * handlers can ignore the 
return value.
f461d2dcd511c0 Christoph Hellwig 2020-04-24  316   */
f461d2dcd511c0 Christoph Hellwig 2020-04-24 @317  static bool 
proc_first_pos_non_zero_ignore(loff_t *ppos,
f461d2dcd511c0 Christoph Hellwig 2020-04-24  318                                
           struct ctl_table *table)
^1da177e4c3f41 Linus Torvalds    2005-04-16  319  {
f461d2dcd511c0 Christoph Hellwig 2020-04-24  320        if (!*ppos)
f461d2dcd511c0 Christoph Hellwig 2020-04-24  321                return false;
f461d2dcd511c0 Christoph Hellwig 2020-04-24  322  
f461d2dcd511c0 Christoph Hellwig 2020-04-24  323        switch 
(sysctl_writes_strict) {
f461d2dcd511c0 Christoph Hellwig 2020-04-24  324        case 
SYSCTL_WRITES_STRICT:
f461d2dcd511c0 Christoph Hellwig 2020-04-24  325                return true;
f461d2dcd511c0 Christoph Hellwig 2020-04-24  326        case SYSCTL_WRITES_WARN:
f461d2dcd511c0 Christoph Hellwig 2020-04-24  327                
warn_sysctl_write(table);
f461d2dcd511c0 Christoph Hellwig 2020-04-24  328                return false;
f461d2dcd511c0 Christoph Hellwig 2020-04-24  329        default:
f461d2dcd511c0 Christoph Hellwig 2020-04-24  330                return false;
f461d2dcd511c0 Christoph Hellwig 2020-04-24  331        }
f461d2dcd511c0 Christoph Hellwig 2020-04-24  332  }
f461d2dcd511c0 Christoph Hellwig 2020-04-24  333  

:::::: The code at line 317 was first introduced by commit
:::::: f461d2dcd511c020a26d4d791fae595c65ed09b6 sysctl: avoid forward 
declarations

:::::: TO: Christoph Hellwig <[email protected]>
:::::: CC: Al Viro <[email protected]>

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