* [android-common:android11-kiwi-5.4 430/430] include/linux/cgroup-defs.h:848 sock_cgroup_set_prioidx() warn: maybe use && instead of &
@ 2025-03-19 10:48 kernel test robot
0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2025-03-19 10:48 UTC (permalink / raw)
To: oe-kbuild; +Cc: lkp, Dan Carpenter
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: 32 hours ago
:::::: commit date: 4 years, 8 months ago
config: i386-randconfig-141-20250319 (https://download.01.org/0day-ci/archive/20250319/202503191817.aDxsFZPp-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/202503191817.aDxsFZPp-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
^ permalink raw reply [flat|nested] 2+ messages in thread* [android-common:android11-kiwi-5.4 430/430] include/linux/cgroup-defs.h:848 sock_cgroup_set_prioidx() warn: maybe use && instead of &
@ 2025-03-19 3:21 kernel test robot
0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2025-03-19 3:21 UTC (permalink / raw)
To: oe-kbuild; +Cc: lkp, Dan Carpenter
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-03-19 10:49 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
-- strict thread matches above, loose matches on Subject: below --
2025-03-19 3:21 kernel test robot
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.