Re: [PATCH] cgroup: Avoid compiler warnings with no subsystems

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Kees,

I love your patch! Perhaps something to improve:

[auto build test WARNING on cgroup/for-next]
[also build test WARNING on kees/for-next/pstore v5.14-rc7 next-20210826]
[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]

url:    https://github.com/0day-ci/linux/commits/Kees-Cook/cgroup-Avoid-compiler-warnings-with-no-subsystems/20210827-115012
base:   https://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup.git for-next
config: arm64-buildonly-randconfig-r005-20210827 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 1076082a0d97bd5c16a25ee7cf3dbb6ee4b5a9fe)
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
        # install arm64 cross compiling tool for clang build
        # apt-get install binutils-aarch64-linux-gnu
        # https://github.com/0day-ci/linux/commit/3e93974a5c6d03c5444c3acbaf67061d0897fb96
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Kees-Cook/cgroup-Avoid-compiler-warnings-with-no-subsystems/20210827-115012
        git checkout 3e93974a5c6d03c5444c3acbaf67061d0897fb96
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>):

>> kernel/cgroup/cgroup.c:475:26: warning: converting the enum constant to a boolean [-Wint-in-bool-context]
           if (CGROUP_SUBSYS_COUNT && ss)
                                   ^
   kernel/cgroup/cgroup.c:656:26: warning: converting the enum constant to a boolean [-Wint-in-bool-context]
           if (CGROUP_SUBSYS_COUNT && cft->ss)
                                   ^
   kernel/cgroup/cgroup.c:2381:29: warning: converting the enum constant to a boolean [-Wint-in-bool-context]
           while (CGROUP_SUBSYS_COUNT && &cset->mg_node != tset->csets) {
                                      ^
   kernel/cgroup/cgroup.c:4652:26: warning: converting the enum constant to a boolean [-Wint-in-bool-context]
           if (CGROUP_SUBSYS_COUNT && it->ss)
                                   ^
   4 warnings generated.


vim +475 kernel/cgroup/cgroup.c

   460	
   461	/**
   462	 * cgroup_css - obtain a cgroup's css for the specified subsystem
   463	 * @cgrp: the cgroup of interest
   464	 * @ss: the subsystem of interest (%NULL returns @cgrp->self)
   465	 *
   466	 * Return @cgrp's css (cgroup_subsys_state) associated with @ss.  This
   467	 * function must be called either under cgroup_mutex or rcu_read_lock() and
   468	 * the caller is responsible for pinning the returned css if it wants to
   469	 * keep accessing it outside the said locks.  This function may return
   470	 * %NULL if @cgrp doesn't have @subsys_id enabled.
   471	 */
   472	static struct cgroup_subsys_state *cgroup_css(struct cgroup *cgrp,
   473						      struct cgroup_subsys *ss)
   474	{
 > 475		if (CGROUP_SUBSYS_COUNT && ss)
   476			return rcu_dereference_check(cgrp->subsys[ss->id],
   477						lockdep_is_held(&cgroup_mutex));
   478		else
   479			return &cgrp->self;
   480	}
   481	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]     [Monitors]

  Powered by Linux