All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: oe-kbuild@lists.linux.dev
Cc: lkp@intel.com, Dan Carpenter <error27@gmail.com>
Subject: [android-common:android11-kiwi-5.4 430/430] include/linux/cgroup-defs.h:848 sock_cgroup_set_prioidx() warn: maybe use && instead of &
Date: Wed, 19 Mar 2025 11:21:19 +0800	[thread overview]
Message-ID: <202503191111.UJNycqFv-lkp@intel.com> (raw)

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
TO: cros-kernel-buildreports@googlegroups.com

tree:   https://android.googlesource.com/kernel/common android11-kiwi-5.4
head:   c7a783cd03e4bfc526f5579f85582d5b1734ee4f
commit: 94886c86e833dbc8995202b6c6aaff592b7abd24 [430/430] cgroup: fix cgroup_sk_alloc() for sk_clone_lock()
:::::: branch date: 24 hours ago
:::::: commit date: 4 years, 8 months ago
config: i386-randconfig-141-20250319 (https://download.01.org/0day-ci/archive/20250319/202503191111.UJNycqFv-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0

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>
| Reported-by: Dan Carpenter <error27@gmail.com>
| Closes: https://lore.kernel.org/r/202503191111.UJNycqFv-lkp@intel.com/

New smatch warnings:
include/linux/cgroup-defs.h:848 sock_cgroup_set_prioidx() warn: maybe use && instead of &
include/linux/cgroup-defs.h:827 sock_cgroup_prioidx() warn: maybe use && instead of &
include/linux/cgroup-defs.h:848 sock_cgroup_set_prioidx() warn: maybe use && instead of &
include/linux/cgroup-defs.h:827 sock_cgroup_prioidx() warn: maybe use && instead of &
include/linux/cgroup-defs.h:827 sock_cgroup_prioidx() warn: maybe use && instead of &
include/linux/cgroup-defs.h:848 sock_cgroup_set_prioidx() warn: maybe use && instead of &
include/linux/cgroup-defs.h:827 sock_cgroup_prioidx() warn: maybe use && instead of &

Old smatch warnings:
include/linux/cgroup-defs.h:865 sock_cgroup_set_classid() warn: maybe use && instead of &
include/linux/cgroup-defs.h:833 sock_cgroup_classid() warn: maybe use && instead of &
include/linux/cgroup-defs.h:865 sock_cgroup_set_classid() warn: maybe use && instead of &
include/linux/cgroup-defs.h:833 sock_cgroup_classid() warn: maybe use && instead of &
net/core/dev.c:9357 netdev_run_todo() warn: passing freed memory 'dev' (line 9353)

vim +848 include/linux/cgroup-defs.h

2a56a1fec290bf Tejun Heo    2015-12-07  818  
bd1060a1d67128 Tejun Heo    2015-12-07  819  /*
bd1060a1d67128 Tejun Heo    2015-12-07  820   * There's a theoretical window where the following accessors race with
bd1060a1d67128 Tejun Heo    2015-12-07  821   * updaters and return part of the previous pointer as the prioidx or
bd1060a1d67128 Tejun Heo    2015-12-07  822   * classid.  Such races are short-lived and the result isn't critical.
bd1060a1d67128 Tejun Heo    2015-12-07  823   */
4dcb31d4649df3 Eric Dumazet 2018-03-14  824  static inline u16 sock_cgroup_prioidx(const struct sock_cgroup_data *skcd)
2a56a1fec290bf Tejun Heo    2015-12-07  825  {
bd1060a1d67128 Tejun Heo    2015-12-07  826  	/* fallback to 1 which is always the ID of the root cgroup */
bd1060a1d67128 Tejun Heo    2015-12-07 @827  	return (skcd->is_data & 1) ? skcd->prioidx : 1;
2a56a1fec290bf Tejun Heo    2015-12-07  828  }
2a56a1fec290bf Tejun Heo    2015-12-07  829  
4dcb31d4649df3 Eric Dumazet 2018-03-14  830  static inline u32 sock_cgroup_classid(const struct sock_cgroup_data *skcd)
2a56a1fec290bf Tejun Heo    2015-12-07  831  {
bd1060a1d67128 Tejun Heo    2015-12-07  832  	/* fallback to 0 which is the unconfigured default classid */
bd1060a1d67128 Tejun Heo    2015-12-07  833  	return (skcd->is_data & 1) ? skcd->classid : 0;
2a56a1fec290bf Tejun Heo    2015-12-07  834  }
2a56a1fec290bf Tejun Heo    2015-12-07  835  
bd1060a1d67128 Tejun Heo    2015-12-07  836  /*
bd1060a1d67128 Tejun Heo    2015-12-07  837   * If invoked concurrently, the updaters may clobber each other.  The
bd1060a1d67128 Tejun Heo    2015-12-07  838   * caller is responsible for synchronization.
bd1060a1d67128 Tejun Heo    2015-12-07  839   */
2a56a1fec290bf Tejun Heo    2015-12-07  840  static inline void sock_cgroup_set_prioidx(struct sock_cgroup_data *skcd,
2a56a1fec290bf Tejun Heo    2015-12-07  841  					   u16 prioidx)
2a56a1fec290bf Tejun Heo    2015-12-07  842  {
ad2c8c73d29702 Tejun Heo    2015-12-09  843  	struct sock_cgroup_data skcd_buf = {{ .val = READ_ONCE(skcd->val) }};
bd1060a1d67128 Tejun Heo    2015-12-07  844  
bd1060a1d67128 Tejun Heo    2015-12-07  845  	if (sock_cgroup_prioidx(&skcd_buf) == prioidx)
bd1060a1d67128 Tejun Heo    2015-12-07  846  		return;
bd1060a1d67128 Tejun Heo    2015-12-07  847  
bd1060a1d67128 Tejun Heo    2015-12-07 @848  	if (!(skcd_buf.is_data & 1)) {
bd1060a1d67128 Tejun Heo    2015-12-07  849  		skcd_buf.val = 0;
bd1060a1d67128 Tejun Heo    2015-12-07  850  		skcd_buf.is_data = 1;
bd1060a1d67128 Tejun Heo    2015-12-07  851  	}
bd1060a1d67128 Tejun Heo    2015-12-07  852  
bd1060a1d67128 Tejun Heo    2015-12-07  853  	skcd_buf.prioidx = prioidx;
bd1060a1d67128 Tejun Heo    2015-12-07  854  	WRITE_ONCE(skcd->val, skcd_buf.val);	/* see sock_cgroup_ptr() */
2a56a1fec290bf Tejun Heo    2015-12-07  855  }
2a56a1fec290bf Tejun Heo    2015-12-07  856  

:::::: The code at line 848 was first introduced by commit
:::::: bd1060a1d67128bb8fbe2e1384c518912cbe54e7 sock, cgroup: add sock->sk_cgroup

:::::: TO: Tejun Heo <tj@kernel.org>
:::::: CC: David S. Miller <davem@davemloft.net>

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

             reply	other threads:[~2025-03-19  3:22 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-19  3:21 kernel test robot [this message]
  -- strict thread matches above, loose matches on Subject: below --
2025-03-19 10:48 [android-common:android11-kiwi-5.4 430/430] include/linux/cgroup-defs.h:848 sock_cgroup_set_prioidx() warn: maybe use && instead of & 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=202503191111.UJNycqFv-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=error27@gmail.com \
    --cc=oe-kbuild@lists.linux.dev \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.