:::::: 
:::::: Manual check reason: "low confidence bisect report"
:::::: Manual check reason: "low confidence static check warning: 
kernel/sysctl.c:1256:48: warning: use of uninitialized value 'tmp' [CWE-457] 
[-Wanalyzer-use-of-uninitialized-value]"
:::::: 

BCC: [email protected]
CC: [email protected]
CC: [email protected]
TO: Yuwei Wang <[email protected]>
CC: Paolo Abeni <[email protected]>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   1612c382ffbdf1f673caec76502b1c00e6d35363
commit: c381d02b2fd5f82d2207db1b9b25ff60d0d9c27c sysctl: add 
proc_dointvec_ms_jiffies_minmax
date:   5 weeks ago
:::::: branch date: 4 hours ago
:::::: commit date: 5 weeks ago
config: arm-randconfig-c002-20220805 
(https://download.01.org/0day-ci/archive/20220807/[email protected]/config)
compiler: arm-linux-gnueabi-gcc (GCC) 12.1.0
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/torvalds/linux.git/commit/?id=c381d02b2fd5f82d2207db1b9b25ff60d0d9c27c
        git remote add linus 
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout c381d02b2fd5f82d2207db1b9b25ff60d0d9c27c
        # save the config file
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross 
ARCH=arm KBUILD_USERCFLAGS='-fanalyzer -Wno-error' 

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

gcc-analyzer warnings: (new ones prefixed by >>)
   kernel/sysctl.c: In function 'do_proc_dointvec_ms_jiffies_minmax_conv':
>> kernel/sysctl.c:1256:48: warning: use of uninitialized value 'tmp' [CWE-457] 
>> [-Wanalyzer-use-of-uninitialized-value]
    1256 |                 if ((param->min && *param->min > tmp) ||
         |                                    ~~~~~~~~~~~~^~~~~
     'do_proc_dointvec_ms_jiffies_minmax_conv': events 1-8
       |
       | 1243 |         int tmp, ret;
       |      |             ^~~
       |      |             |
       |      |             (1) region created on stack here
       |......
       | 1252 |         if (ret)
       |      |            ~ 
       |      |            |
       |      |            (2) following 'false' branch (when 'ret == 0')...
       |......
       | 1255 |         if (write) {
       |      |            ~ 
       |      |            |
       |      |            (3) ...to here
       |      |            (4) following 'true' branch (when 'write != 0')...
       | 1256 |                 if ((param->min && *param->min > tmp) ||
       |      |                    ~ ~~~~~~~~~~    ~~~~~~~~~~~~~~~~~
       |      |                    |      |        |           |
       |      |                    |      |        |           (8) use of 
uninitialized value 'tmp' here
       |      |                    |      |        (7) ...to here
       |      |                    |      (5) ...to here
       |      |                    (6) following 'true' branch...
       |
   kernel/sysctl.c:1257:60: warning: use of uninitialized value 'tmp' [CWE-457] 
[-Wanalyzer-use-of-uninitialized-value]
    1257 |                                 (param->max && *param->max < tmp))
         |                                                ~~~~~~~~~~~~^~~~~
     'do_proc_dointvec_ms_jiffies_minmax_conv': events 1-8
       |
       | 1243 |         int tmp, ret;
       |      |             ^~~
       |      |             |
       |      |             (1) region created on stack here
       |......
       | 1252 |         if (ret)
       |      |            ~ 
       |      |            |
       |      |            (2) following 'false' branch (when 'ret == 0')...
       |......
       | 1255 |         if (write) {
       |      |            ~ 
       |      |            |
       |      |            (3) ...to here
       |      |            (4) following 'true' branch (when 'write != 0')...
       | 1256 |                 if ((param->min && *param->min > tmp) ||
       |      |                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       |      |                           |                           |
       |      |                           (5) ...to here              (6) 
following 'true' branch...
       | 1257 |                                 (param->max && *param->max < 
tmp))
       |      |                                 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       |      |                                                |           |
       |      |                                                |           (8) 
use of uninitialized value 'tmp' here
       |      |                                                (7) ...to here
       |
   kernel/sysctl.c:1259:23: warning: use of uninitialized value 'tmp' [CWE-457] 
[-Wanalyzer-use-of-uninitialized-value]
    1259 |                 *valp = tmp;
         |                 ~~~~~~^~~~~
     'do_proc_dointvec_ms_jiffies_minmax_conv': events 1-6
       |
       | 1243 |         int tmp, ret;
       |      |             ^~~
       |      |             |
       |      |             (1) region created on stack here
       |......
       | 1252 |         if (ret)
       |      |            ~ 
       |      |            |
       |      |            (2) following 'false' branch (when 'ret == 0')...
       |......
       | 1255 |         if (write) {
       |      |            ~ 
       |      |            |
       |      |            (3) ...to here
       |      |            (4) following 'true' branch (when 'write != 0')...
       | 1256 |                 if ((param->min && *param->min > tmp) ||
       |      |                      ~~~~~~~~~~
       |      |                           |
       |      |                           (5) ...to here
       |......
       | 1259 |                 *valp = tmp;
       |      |                 ~~~~~~~~~~~
       |      |                       |
       |      |                       (6) use of uninitialized value 'tmp' here
       |

vim +/tmp +1256 kernel/sysctl.c

f461d2dcd511c0 Christoph Hellwig 2020-04-24  1239  
c381d02b2fd5f8 Yuwei Wang        2022-06-29  1240  static int 
do_proc_dointvec_ms_jiffies_minmax_conv(bool *negp, unsigned long *lvalp,
c381d02b2fd5f8 Yuwei Wang        2022-06-29  1241                               
                int *valp, int write, void *data)
c381d02b2fd5f8 Yuwei Wang        2022-06-29  1242  {
c381d02b2fd5f8 Yuwei Wang        2022-06-29  1243       int tmp, ret;
c381d02b2fd5f8 Yuwei Wang        2022-06-29  1244       struct 
do_proc_dointvec_minmax_conv_param *param = data;
c381d02b2fd5f8 Yuwei Wang        2022-06-29  1245       /*
c381d02b2fd5f8 Yuwei Wang        2022-06-29  1246        * If writing, first do 
so via a temporary local int so we can
c381d02b2fd5f8 Yuwei Wang        2022-06-29  1247        * bounds-check it 
before touching *valp.
c381d02b2fd5f8 Yuwei Wang        2022-06-29  1248        */
c381d02b2fd5f8 Yuwei Wang        2022-06-29  1249       int *ip = write ? &tmp 
: valp;
c381d02b2fd5f8 Yuwei Wang        2022-06-29  1250  
c381d02b2fd5f8 Yuwei Wang        2022-06-29  1251       ret = 
do_proc_dointvec_ms_jiffies_conv(negp, lvalp, ip, write, data);
c381d02b2fd5f8 Yuwei Wang        2022-06-29  1252       if (ret)
c381d02b2fd5f8 Yuwei Wang        2022-06-29  1253               return ret;
c381d02b2fd5f8 Yuwei Wang        2022-06-29  1254  
c381d02b2fd5f8 Yuwei Wang        2022-06-29  1255       if (write) {
c381d02b2fd5f8 Yuwei Wang        2022-06-29 @1256               if ((param->min 
&& *param->min > tmp) ||
c381d02b2fd5f8 Yuwei Wang        2022-06-29  1257                               
(param->max && *param->max < tmp))
c381d02b2fd5f8 Yuwei Wang        2022-06-29  1258                       return 
-EINVAL;
c381d02b2fd5f8 Yuwei Wang        2022-06-29  1259               *valp = tmp;
c381d02b2fd5f8 Yuwei Wang        2022-06-29  1260       }
c381d02b2fd5f8 Yuwei Wang        2022-06-29  1261       return 0;
c381d02b2fd5f8 Yuwei Wang        2022-06-29  1262  }
c381d02b2fd5f8 Yuwei Wang        2022-06-29  1263  

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