public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: ran xiaokai <ranxiaokai627@163.com>,
	elver@google.com, tglx@linutronix.de, dvyukov@google.com
Cc: llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev,
	kasan-dev@googlegroups.com, linux-kernel@vger.kernel.org,
	Ran Xiaokai <ran.xiaokai@zte.com.cn>
Subject: Re: [PATCH 2/4] kcsan, debugfs: refactor set_report_filterlist_whitelist() to return a value
Date: Thu, 26 Sep 2024 13:58:39 +0800	[thread overview]
Message-ID: <202409261331.9NyGRPt2-lkp@intel.com> (raw)
In-Reply-To: <20240925143154.2322926-3-ranxiaokai627@163.com>

Hi ran,

kernel test robot noticed the following build warnings:

[auto build test WARNING on linus/master]
[also build test WARNING on next-20240925]
[cannot apply to v6.11]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/ran-xiaokai/kcsan-debugfs-Remove-redundant-call-of-kallsyms_lookup_name/20240925-231034
base:   linus/master
patch link:    https://lore.kernel.org/r/20240925143154.2322926-3-ranxiaokai627%40163.com
patch subject: [PATCH 2/4] kcsan, debugfs: refactor set_report_filterlist_whitelist() to return a value
config: x86_64-allyesconfig (https://download.01.org/0day-ci/archive/20240926/202409261331.9NyGRPt2-lkp@intel.com/config)
compiler: clang version 18.1.8 (https://github.com/llvm/llvm-project 3b5b5c1ec4a3095ab096dd780e84d7ab81f3d7ff)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240926/202409261331.9NyGRPt2-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202409261331.9NyGRPt2-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> kernel/kcsan/debugfs.c:243:7: warning: variable 'ret' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
     243 |                 if (kstrtoul(&arg[strlen("microbench=")], 0, &iters))
         |                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   kernel/kcsan/debugfs.c:256:6: note: uninitialized use occurs here
     256 |         if (ret < 0)
         |             ^~~
   kernel/kcsan/debugfs.c:243:3: note: remove the 'if' if its condition is always true
     243 |                 if (kstrtoul(&arg[strlen("microbench=")], 0, &iters))
         |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     244 |                         return -EINVAL;
>> kernel/kcsan/debugfs.c:238:13: warning: variable 'ret' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
     238 |         } else if (!strcmp(arg, "off")) {
         |                    ^~~~~~~~~~~~~~~~~~~
   kernel/kcsan/debugfs.c:256:6: note: uninitialized use occurs here
     256 |         if (ret < 0)
         |             ^~~
   kernel/kcsan/debugfs.c:238:9: note: remove the 'if' if its condition is always false
     238 |         } else if (!strcmp(arg, "off")) {
         |                ^~~~~~~~~~~~~~~~~~~~~~~~~~
     239 |                 WRITE_ONCE(kcsan_enabled, false);
         |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     240 |         } else if (str_has_prefix(arg, "microbench=")) {
         |         ~~~~~~
   kernel/kcsan/debugfs.c:236:6: warning: variable 'ret' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
     236 |         if (!strcmp(arg, "on")) {
         |             ^~~~~~~~~~~~~~~~~~
   kernel/kcsan/debugfs.c:256:6: note: uninitialized use occurs here
     256 |         if (ret < 0)
         |             ^~~
   kernel/kcsan/debugfs.c:236:2: note: remove the 'if' if its condition is always false
     236 |         if (!strcmp(arg, "on")) {
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~
     237 |                 WRITE_ONCE(kcsan_enabled, true);
         |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     238 |         } else if (!strcmp(arg, "off")) {
         |         ~~~~~~
   kernel/kcsan/debugfs.c:229:13: note: initialize the variable 'ret' to silence this warning
     229 |         ssize_t ret;
         |                    ^
         |                     = 0
   3 warnings generated.


vim +243 kernel/kcsan/debugfs.c

dfd402a4c4baae Marco Elver   2019-11-14  222  
5cbaefe9743bf1 Ingo Molnar   2019-11-20  223  static ssize_t
5cbaefe9743bf1 Ingo Molnar   2019-11-20  224  debugfs_write(struct file *file, const char __user *buf, size_t count, loff_t *off)
dfd402a4c4baae Marco Elver   2019-11-14  225  {
dfd402a4c4baae Marco Elver   2019-11-14  226  	char kbuf[KSYM_NAME_LEN];
dfd402a4c4baae Marco Elver   2019-11-14  227  	char *arg;
43d631bf06ec96 Thorsten Blum 2024-06-24  228  	const size_t read_len = min(count, sizeof(kbuf) - 1);
52313281c8b7ca Ran Xiaokai   2024-09-25  229  	ssize_t ret;
dfd402a4c4baae Marco Elver   2019-11-14  230  
dfd402a4c4baae Marco Elver   2019-11-14  231  	if (copy_from_user(kbuf, buf, read_len))
dfd402a4c4baae Marco Elver   2019-11-14  232  		return -EFAULT;
dfd402a4c4baae Marco Elver   2019-11-14  233  	kbuf[read_len] = '\0';
dfd402a4c4baae Marco Elver   2019-11-14  234  	arg = strstrip(kbuf);
dfd402a4c4baae Marco Elver   2019-11-14  235  
dfd402a4c4baae Marco Elver   2019-11-14  236  	if (!strcmp(arg, "on")) {
dfd402a4c4baae Marco Elver   2019-11-14  237  		WRITE_ONCE(kcsan_enabled, true);
dfd402a4c4baae Marco Elver   2019-11-14 @238  	} else if (!strcmp(arg, "off")) {
dfd402a4c4baae Marco Elver   2019-11-14  239  		WRITE_ONCE(kcsan_enabled, false);
a4e74fa5f0d3e2 Marco Elver   2020-07-31  240  	} else if (str_has_prefix(arg, "microbench=")) {
dfd402a4c4baae Marco Elver   2019-11-14  241  		unsigned long iters;
dfd402a4c4baae Marco Elver   2019-11-14  242  
a4e74fa5f0d3e2 Marco Elver   2020-07-31 @243  		if (kstrtoul(&arg[strlen("microbench=")], 0, &iters))
dfd402a4c4baae Marco Elver   2019-11-14  244  			return -EINVAL;
dfd402a4c4baae Marco Elver   2019-11-14  245  		microbenchmark(iters);
dfd402a4c4baae Marco Elver   2019-11-14  246  	} else if (!strcmp(arg, "whitelist")) {
52313281c8b7ca Ran Xiaokai   2024-09-25  247  		ret = set_report_filterlist_whitelist(true);
dfd402a4c4baae Marco Elver   2019-11-14  248  	} else if (!strcmp(arg, "blacklist")) {
52313281c8b7ca Ran Xiaokai   2024-09-25  249  		ret = set_report_filterlist_whitelist(false);
dfd402a4c4baae Marco Elver   2019-11-14  250  	} else if (arg[0] == '!') {
52313281c8b7ca Ran Xiaokai   2024-09-25  251  		ret = insert_report_filterlist(&arg[1]);
dfd402a4c4baae Marco Elver   2019-11-14  252  	} else {
dfd402a4c4baae Marco Elver   2019-11-14  253  		return -EINVAL;
dfd402a4c4baae Marco Elver   2019-11-14  254  	}
dfd402a4c4baae Marco Elver   2019-11-14  255  
52313281c8b7ca Ran Xiaokai   2024-09-25  256  	if (ret < 0)
52313281c8b7ca Ran Xiaokai   2024-09-25  257  		return ret;
52313281c8b7ca Ran Xiaokai   2024-09-25  258  	else
dfd402a4c4baae Marco Elver   2019-11-14  259  		return count;
dfd402a4c4baae Marco Elver   2019-11-14  260  }
dfd402a4c4baae Marco Elver   2019-11-14  261  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

  reply	other threads:[~2024-09-26  5:58 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-25 14:31 [PATCH 0/4] kcsan, debugfs: fix atomic sleep by converting spinlock_t to rcu lock ran xiaokai
2024-09-25 14:31 ` [PATCH 1/4] kcsan, debugfs: Remove redundant call of kallsyms_lookup_name() ran xiaokai
2024-10-01 13:57   ` Marco Elver
2024-09-25 14:31 ` [PATCH 2/4] kcsan, debugfs: refactor set_report_filterlist_whitelist() to return a value ran xiaokai
2024-09-26  5:58   ` kernel test robot [this message]
2024-10-01 13:56   ` Marco Elver
2024-09-25 14:31 ` [PATCH 3/4] kcsan, debugfs: fix atomic sleep by converting spinlock_t to rcu lock ran xiaokai
2024-10-01 14:13   ` Marco Elver
2024-10-08  6:26     ` Ran Xiaokai
2024-09-25 14:31 ` [PATCH 4/4] kcsan, debugfs: avoid updating white/blacklist with the same value ran xiaokai
2024-10-01 13:56   ` Marco Elver

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=202409261331.9NyGRPt2-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=dvyukov@google.com \
    --cc=elver@google.com \
    --cc=kasan-dev@googlegroups.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=ran.xiaokai@zte.com.cn \
    --cc=ranxiaokai627@163.com \
    --cc=tglx@linutronix.de \
    /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