From: kernel test robot <lkp@intel.com>
To: kbuild@lists.01.org
Subject: kernel/sysctl.c:1256:48: warning: use of uninitialized value 'tmp' [CWE-457]
Date: Sat, 06 Aug 2022 05:53:43 +0800 [thread overview]
Message-ID: <202208060501.k6Ga2XKJ-lkp@intel.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 8295 bytes --]
::::::
:::::: 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: lkp(a)intel.com
CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: Yuwei Wang <wangyuweihx@gmail.com>
CC: Paolo Abeni <pabeni@redhat.com>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 9e2f40233670c70c25e0681cb66d50d1e2742829
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/20220806/202208060501.k6Ga2XKJ-lkp(a)intel.com/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 <lkp@intel.com>
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
next reply other threads:[~2022-08-05 21:53 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-05 21:53 kernel test robot [this message]
2022-08-07 4:41 kernel/sysctl.c:1256:48: warning: use of uninitialized value 'tmp' [CWE-457] kernel test robot
2022-09-11 9:09 kernel test robot
2022-11-20 1:49 kernel test robot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=202208060501.k6Ga2XKJ-lkp@intel.com \
--to=lkp@intel.com \
--cc=kbuild@lists.01.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).