From: kernel test robot <lkp@intel.com>
To: Li kunyu <kunyu@nfschina.com>,
tj@kernel.org, lizefan.x@bytedance.com, hannes@cmpxchg.org
Cc: llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev,
cgroups@vger.kernel.org, linux-kernel@vger.kernel.org,
Li kunyu <kunyu@nfschina.com>
Subject: Re: [PATCH] cgroup: cgroup: Remove unnecessary ‘NULL’ values from res
Date: Sat, 12 Aug 2023 13:43:51 +0800 [thread overview]
Message-ID: <202308121338.k2YdCXVR-lkp@intel.com> (raw)
In-Reply-To: <20230813015142.3095-1-kunyu@nfschina.com>
Hi Li,
kernel test robot noticed the following build warnings:
[auto build test WARNING on tj-cgroup/for-next]
[cannot apply to linus/master v6.5-rc5 next-20230809]
[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/Li-kunyu/cgroup-cgroup-Remove-unnecessary-NULL-values-from-res/20230811-172322
base: https://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup.git for-next
patch link: https://lore.kernel.org/r/20230813015142.3095-1-kunyu%40nfschina.com
patch subject: [PATCH] cgroup: cgroup: Remove unnecessary ‘NULL’ values from res
config: x86_64-randconfig-x002-20230812 (https://download.01.org/0day-ci/archive/20230812/202308121338.k2YdCXVR-lkp@intel.com/config)
compiler: clang version 16.0.4 (https://github.com/llvm/llvm-project.git ae42196bc493ffe877a7e3dff8be32035dea4d07)
reproduce: (https://download.01.org/0day-ci/archive/20230812/202308121338.k2YdCXVR-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/202308121338.k2YdCXVR-lkp@intel.com/
All warnings (new ones prefixed by >>):
>> kernel/cgroup/cgroup.c:1380:3: warning: variable 'res' is used uninitialized whenever 'for' loop exits because its condition is false [-Wsometimes-uninitialized]
list_for_each_entry(link, &cset->cgrp_links, cgrp_link) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/list.h:578:7: note: expanded from macro 'list_for_each_entry'
&pos->member != (head); \
^~~~~~~~~~~~~~~~~~~~~~
kernel/cgroup/cgroup.c:1391:10: note: uninitialized use occurs here
BUG_ON(!res);
^~~
include/asm-generic/bug.h:62:45: note: expanded from macro 'BUG_ON'
#define BUG_ON(condition) do { if (unlikely(condition)) BUG(); } while (0)
^~~~~~~~~
include/linux/compiler.h:78:42: note: expanded from macro 'unlikely'
# define unlikely(x) __builtin_expect(!!(x), 0)
^
kernel/cgroup/cgroup.c:1380:3: note: remove the condition if it is always true
list_for_each_entry(link, &cset->cgrp_links, cgrp_link) {
^
include/linux/list.h:578:7: note: expanded from macro 'list_for_each_entry'
&pos->member != (head); \
^
kernel/cgroup/cgroup.c:1367:20: note: initialize the variable 'res' to silence this warning
struct cgroup *res;
^
= NULL
1 warning generated.
vim +1380 kernel/cgroup/cgroup.c
f2e85d574e881f kernel/cgroup.c Tejun Heo 2014-02-11 1359
4f41fc59620fce kernel/cgroup.c Serge E. Hallyn 2016-05-09 1360 /*
4f41fc59620fce kernel/cgroup.c Serge E. Hallyn 2016-05-09 1361 * look up cgroup associated with current task's cgroup namespace on the
4f41fc59620fce kernel/cgroup.c Serge E. Hallyn 2016-05-09 1362 * specified hierarchy
4f41fc59620fce kernel/cgroup.c Serge E. Hallyn 2016-05-09 1363 */
4f41fc59620fce kernel/cgroup.c Serge E. Hallyn 2016-05-09 1364 static struct cgroup *
4f41fc59620fce kernel/cgroup.c Serge E. Hallyn 2016-05-09 1365 current_cgns_cgroup_from_root(struct cgroup_root *root)
4f41fc59620fce kernel/cgroup.c Serge E. Hallyn 2016-05-09 1366 {
aa6f66ec5ebc27 kernel/cgroup/cgroup.c Li kunyu 2023-08-13 1367 struct cgroup *res;
4f41fc59620fce kernel/cgroup.c Serge E. Hallyn 2016-05-09 1368 struct css_set *cset;
4f41fc59620fce kernel/cgroup.c Serge E. Hallyn 2016-05-09 1369
4f41fc59620fce kernel/cgroup.c Serge E. Hallyn 2016-05-09 1370 lockdep_assert_held(&css_set_lock);
4f41fc59620fce kernel/cgroup.c Serge E. Hallyn 2016-05-09 1371
4f41fc59620fce kernel/cgroup.c Serge E. Hallyn 2016-05-09 1372 rcu_read_lock();
4f41fc59620fce kernel/cgroup.c Serge E. Hallyn 2016-05-09 1373
4f41fc59620fce kernel/cgroup.c Serge E. Hallyn 2016-05-09 1374 cset = current->nsproxy->cgroup_ns->root_cset;
4f41fc59620fce kernel/cgroup.c Serge E. Hallyn 2016-05-09 1375 if (cset == &init_css_set) {
4f41fc59620fce kernel/cgroup.c Serge E. Hallyn 2016-05-09 1376 res = &root->cgrp;
4f41fc59620fce kernel/cgroup.c Serge E. Hallyn 2016-05-09 1377 } else {
4f41fc59620fce kernel/cgroup.c Serge E. Hallyn 2016-05-09 1378 struct cgrp_cset_link *link;
4f41fc59620fce kernel/cgroup.c Serge E. Hallyn 2016-05-09 1379
4f41fc59620fce kernel/cgroup.c Serge E. Hallyn 2016-05-09 @1380 list_for_each_entry(link, &cset->cgrp_links, cgrp_link) {
4f41fc59620fce kernel/cgroup.c Serge E. Hallyn 2016-05-09 1381 struct cgroup *c = link->cgrp;
4f41fc59620fce kernel/cgroup.c Serge E. Hallyn 2016-05-09 1382
4f41fc59620fce kernel/cgroup.c Serge E. Hallyn 2016-05-09 1383 if (c->root == root) {
4f41fc59620fce kernel/cgroup.c Serge E. Hallyn 2016-05-09 1384 res = c;
4f41fc59620fce kernel/cgroup.c Serge E. Hallyn 2016-05-09 1385 break;
4f41fc59620fce kernel/cgroup.c Serge E. Hallyn 2016-05-09 1386 }
4f41fc59620fce kernel/cgroup.c Serge E. Hallyn 2016-05-09 1387 }
4f41fc59620fce kernel/cgroup.c Serge E. Hallyn 2016-05-09 1388 }
4f41fc59620fce kernel/cgroup.c Serge E. Hallyn 2016-05-09 1389 rcu_read_unlock();
4f41fc59620fce kernel/cgroup.c Serge E. Hallyn 2016-05-09 1390
4f41fc59620fce kernel/cgroup.c Serge E. Hallyn 2016-05-09 1391 BUG_ON(!res);
4f41fc59620fce kernel/cgroup.c Serge E. Hallyn 2016-05-09 1392 return res;
4f41fc59620fce kernel/cgroup.c Serge E. Hallyn 2016-05-09 1393 }
4f41fc59620fce kernel/cgroup.c Serge E. Hallyn 2016-05-09 1394
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
prev parent reply other threads:[~2023-08-12 5:43 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-11 9:20 [PATCH] cgroup: cgroup: Remove unnecessary ‘NULL’ values from res Li kunyu
2023-08-12 5:43 ` kernel test robot [this message]
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=202308121338.k2YdCXVR-lkp@intel.com \
--to=lkp@intel.com \
--cc=cgroups@vger.kernel.org \
--cc=hannes@cmpxchg.org \
--cc=kunyu@nfschina.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lizefan.x@bytedance.com \
--cc=llvm@lists.linux.dev \
--cc=oe-kbuild-all@lists.linux.dev \
--cc=tj@kernel.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