* net/ipv4/tcp_metrics.c:1006:41: warning: The result of the left shift is undefined due to shifting by '64', which is greater or equal to the width of type 'unsigned long' [clang-analyzer-core.UndefinedBinaryOperatorResult]
@ 2021-11-07 17:34 kernel test robot
0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2021-11-07 17:34 UTC (permalink / raw)
To: kbuild
[-- Attachment #1: Type: text/plain, Size: 14597 bytes --]
CC: llvm(a)lists.linux.dev
CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: Jakub Jelinek <jakub@redhat.com>
CC: "Peter Zijlstra (Intel)" <peterz@infradead.org>
CC: Andrew Morton <akpm@linux-foundation.org>
CC: Linux Memory Management List <linux-mm@kvack.org>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: b5013d084e03e82ceeab4db8ae8ceeaebe76b0eb
commit: 2f78788b55baa3410b1ec91a576286abe1ad4d6a ilog2: improve ilog2 for constant arguments
date: 11 months ago
:::::: branch date: 18 hours ago
:::::: commit date: 11 months ago
config: riscv-randconfig-c006-20211029 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 5db7568a6a1fcb408eb8988abdaff2a225a8eb72)
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 riscv cross compiling tool for clang build
# apt-get install binutils-riscv64-linux-gnu
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=2f78788b55baa3410b1ec91a576286abe1ad4d6a
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 2f78788b55baa3410b1ec91a576286abe1ad4d6a
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=riscv clang-analyzer
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
clang-analyzer warnings: (new ones prefixed by >>)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/ssb/ssb_driver_extif.h:200:2: note: Returning zero, which participates in a condition later
return 0;
^~~~~~~~
drivers/ssb/main.c:946:6: note: Returning from 'ssb_extif_available'
if (ssb_extif_available(&bus->extif))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/ssb/main.c:946:2: note: Taking false branch
if (ssb_extif_available(&bus->extif))
^
drivers/ssb/main.c:949:11: note: Assuming field 'dev' is non-null
else if (bus->chipco.dev)
^~~~~~~~~~~~~~~
drivers/ssb/main.c:949:7: note: Taking true branch
else if (bus->chipco.dev)
^
drivers/ssb/main.c:955:6: note: Assuming field 'chip_id' is not equal to 21349
if (bus->chip_id == 0x5365) {
^~~~~~~~~~~~~~~~~~~~~~
drivers/ssb/main.c:955:2: note: Taking false branch
if (bus->chip_id == 0x5365) {
^
drivers/ssb/main.c:958:10: note: Calling 'ssb_calc_clock_rate'
rate = ssb_calc_clock_rate(plltype, clkctl_n, clkctl_m);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/ssb/main.c:849:2: note: Control jumps to 'case 65536:' at line 854
switch (plltype) {
^
drivers/ssb/main.c:860:3: note: Execution continues on line 873
break;
^
drivers/ssb/main.c:873:2: note: Control jumps to the 'default' case at line 878
switch (plltype) {
^
drivers/ssb/main.c:881:6: note: Assuming 'clock' is not equal to 0
if (!clock)
^~~~~~
drivers/ssb/main.c:881:2: note: Taking false branch
if (!clock)
^
drivers/ssb/main.c:889:2: note: Control jumps to 'case 65536:' at line 890
switch (plltype) {
^
drivers/ssb/main.c:894:8: note: Calling 'clkfactor_f6_resolve'
m1 = clkfactor_f6_resolve(m1);
^~~~~~~~~~~~~~~~~~~~~~~~
drivers/ssb/main.c:824:2: note: 'Default' branch taken. Execution continues on line 838
switch (v) {
^
drivers/ssb/main.c:838:2: note: Returning zero
return 0;
^~~~~~~~
drivers/ssb/main.c:894:8: note: Returning from 'clkfactor_f6_resolve'
m1 = clkfactor_f6_resolve(m1);
^~~~~~~~~~~~~~~~~~~~~~~~
drivers/ssb/main.c:894:3: note: The value 0 is assigned to 'm1'
m1 = clkfactor_f6_resolve(m1);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/ssb/main.c:895:8: note: 'plltype' is equal to SSB_PLLTYPE_1
if ((plltype == SSB_PLLTYPE_1) ||
^~~~~~~
drivers/ssb/main.c:895:34: note: Left side of '||' is true
if ((plltype == SSB_PLLTYPE_1) ||
^
drivers/ssb/main.c:900:8: note: Calling 'clkfactor_f6_resolve'
m3 = clkfactor_f6_resolve(m3);
^~~~~~~~~~~~~~~~~~~~~~~~
drivers/ssb/main.c:824:2: note: 'Default' branch taken. Execution continues on line 838
switch (v) {
^
drivers/ssb/main.c:838:2: note: Returning zero
return 0;
^~~~~~~~
drivers/ssb/main.c:900:8: note: Returning from 'clkfactor_f6_resolve'
m3 = clkfactor_f6_resolve(m3);
^~~~~~~~~~~~~~~~~~~~~~~~
drivers/ssb/main.c:900:3: note: The value 0 is assigned to 'm3'
m3 = clkfactor_f6_resolve(m3);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/ssb/main.c:902:3: note: Control jumps to 'case 17:' at line 911
switch (mc) {
^
drivers/ssb/main.c:912:18: note: Division by zero
return (clock / (m1 * m3));
~~~~~~^~~~~~~~~~~
drivers/ssb/main.c:1306:3: warning: Value stored to 'err' is never read [clang-analyzer-deadcode.DeadStores]
err = 0;
^ ~
drivers/ssb/main.c:1306:3: note: Value stored to 'err' is never read
err = 0;
^ ~
drivers/ssb/main.c:1312:3: warning: Value stored to 'err' is never read [clang-analyzer-deadcode.DeadStores]
err = 0;
^ ~
drivers/ssb/main.c:1312:3: note: Value stored to 'err' is never read
err = 0;
^ ~
Suppressed 3 warnings (3 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
4 warnings generated.
>> net/ipv4/tcp_metrics.c:1006:41: warning: The result of the left shift is undefined due to shifting by '64', which is greater or equal to the width of type 'unsigned long' [clang-analyzer-core.UndefinedBinaryOperatorResult]
size = sizeof(struct tcpm_hash_bucket) << tcp_metrics_hash_log;
^ ~~~~~~~~~~~~~~~~~~~~
net/ipv4/tcp_metrics.c:994:7: note: Calling 'net_eq'
if (!net_eq(net, &init_net))
^~~~~~~~~~~~~~~~~~~~~~
include/net/net_namespace.h:296:2: note: Returning the value 1, which participates in a condition later
return 1;
^~~~~~~~
net/ipv4/tcp_metrics.c:994:7: note: Returning from 'net_eq'
if (!net_eq(net, &init_net))
^~~~~~~~~~~~~~~~~~~~~~
net/ipv4/tcp_metrics.c:994:2: note: Taking false branch
if (!net_eq(net, &init_net))
^
net/ipv4/tcp_metrics.c:998:6: note: Assuming 'slots' is not equal to 0
if (!slots) {
^~~~~~
net/ipv4/tcp_metrics.c:998:2: note: Taking false branch
if (!slots) {
^
net/ipv4/tcp_metrics.c:1005:25: note: '?' condition is false
tcp_metrics_hash_log = order_base_2(slots);
^
include/linux/log2.h:219:2: note: expanded from macro 'order_base_2'
__builtin_constant_p(n) ? ( \
^
net/ipv4/tcp_metrics.c:1005:25: note: Calling '__order_base_2'
tcp_metrics_hash_log = order_base_2(slots);
^
include/linux/log2.h:222:2: note: expanded from macro 'order_base_2'
__order_base_2(n) \
^~~~~~~~~~~~~~~~~
include/linux/log2.h:201:9: note: Assuming 'n' is > 1
return n > 1 ? ilog2(n - 1) + 1 : 0;
^~~~~
include/linux/log2.h:201:9: note: '?' condition is true
include/linux/log2.h:201:17: note: '?' condition is false
return n > 1 ? ilog2(n - 1) + 1 : 0;
^
include/linux/log2.h:158:2: note: expanded from macro 'ilog2'
__builtin_constant_p(n) ? \
^
include/linux/log2.h:201:17: note: '?' condition is false
return n > 1 ? ilog2(n - 1) + 1 : 0;
^
include/linux/log2.h:161:2: note: expanded from macro 'ilog2'
(sizeof(n) <= 4) ? \
^
include/linux/log2.h:201:2: note: Returning the value 64
return n > 1 ? ilog2(n - 1) + 1 : 0;
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/ipv4/tcp_metrics.c:1005:25: note: Returning from '__order_base_2'
tcp_metrics_hash_log = order_base_2(slots);
^
include/linux/log2.h:222:2: note: expanded from macro 'order_base_2'
__order_base_2(n) \
^~~~~~~~~~~~~~~~~
net/ipv4/tcp_metrics.c:1005:2: note: The value 64 is assigned to 'tcp_metrics_hash_log'
tcp_metrics_hash_log = order_base_2(slots);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/ipv4/tcp_metrics.c:1006:41: note: The result of the left shift is undefined due to shifting by '64', which is greater or equal to the width of type 'unsigned long'
size = sizeof(struct tcpm_hash_bucket) << tcp_metrics_hash_log;
^ ~~~~~~~~~~~~~~~~~~~~
Suppressed 3 warnings (3 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
4 warnings generated.
Suppressed 4 warnings (4 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
4 warnings generated.
Suppressed 4 warnings (4 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
5 warnings generated.
include/linux/list.h:135:13: warning: Use of memory after it is freed [clang-analyzer-unix.Malloc]
__list_del(entry->prev, entry->next);
^
fs/dlm/member.c:381:2: note: Calling 'clear_memb_list'
clear_memb_list(&ls->ls_nodes_gone);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/dlm/member.c:366:2: note: Loop condition is true. Entering loop body
while (!list_empty(head)) {
^
fs/dlm/member.c:367:10: note: Left side of '&&' is false
memb = list_entry(head->next, struct dlm_member, list);
^
include/linux/list.h:511:2: note: expanded from macro 'list_entry'
container_of(ptr, type, member)
^
include/linux/kernel.h:694:61: note: expanded from macro 'container_of'
BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
^
fs/dlm/member.c:367:10: note: Taking false branch
memb = list_entry(head->next, struct dlm_member, list);
^
include/linux/list.h:511:2: note: expanded from macro 'list_entry'
container_of(ptr, type, member)
^
include/linux/kernel.h:694:2: note: expanded from macro 'container_of'
BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
^
include/linux/build_bug.h:39:37: note: expanded from macro 'BUILD_BUG_ON_MSG'
vim +1006 net/ipv4/tcp_metrics.c
51c5d0c4b169bf David S. Miller 2012-07-10 988
51c5d0c4b169bf David S. Miller 2012-07-10 989 static int __net_init tcp_net_metrics_init(struct net *net)
51c5d0c4b169bf David S. Miller 2012-07-10 990 {
5815d5e7aae3cc Eric Dumazet 2012-07-19 991 size_t size;
5815d5e7aae3cc Eric Dumazet 2012-07-19 992 unsigned int slots;
51c5d0c4b169bf David S. Miller 2012-07-10 993
098a697b497e31 Eric W. Biederman 2015-03-13 994 if (!net_eq(net, &init_net))
098a697b497e31 Eric W. Biederman 2015-03-13 995 return 0;
098a697b497e31 Eric W. Biederman 2015-03-13 996
51c5d0c4b169bf David S. Miller 2012-07-10 997 slots = tcpmhash_entries;
51c5d0c4b169bf David S. Miller 2012-07-10 998 if (!slots) {
ca79b0c211af63 Arun KS 2018-12-28 999 if (totalram_pages() >= 128 * 1024)
51c5d0c4b169bf David S. Miller 2012-07-10 1000 slots = 16 * 1024;
51c5d0c4b169bf David S. Miller 2012-07-10 1001 else
51c5d0c4b169bf David S. Miller 2012-07-10 1002 slots = 8 * 1024;
51c5d0c4b169bf David S. Miller 2012-07-10 1003 }
51c5d0c4b169bf David S. Miller 2012-07-10 1004
098a697b497e31 Eric W. Biederman 2015-03-13 1005 tcp_metrics_hash_log = order_base_2(slots);
098a697b497e31 Eric W. Biederman 2015-03-13 @1006 size = sizeof(struct tcpm_hash_bucket) << tcp_metrics_hash_log;
51c5d0c4b169bf David S. Miller 2012-07-10 1007
752ade68cbd81d Michal Hocko 2017-05-08 1008 tcp_metrics_hash = kvzalloc(size, GFP_KERNEL);
098a697b497e31 Eric W. Biederman 2015-03-13 1009 if (!tcp_metrics_hash)
51c5d0c4b169bf David S. Miller 2012-07-10 1010 return -ENOMEM;
51c5d0c4b169bf David S. Miller 2012-07-10 1011
51c5d0c4b169bf David S. Miller 2012-07-10 1012 return 0;
51c5d0c4b169bf David S. Miller 2012-07-10 1013 }
51c5d0c4b169bf David S. Miller 2012-07-10 1014
:::::: The code@line 1006 was first introduced by commit
:::::: 098a697b497e3154a1a583c1d34c67568acaadcc tcp_metrics: Use a single hash table for all network namespaces.
:::::: TO: Eric W. Biederman <ebiederm@xmission.com>
:::::: CC: David S. Miller <davem@davemloft.net>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 35187 bytes --]
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-11-07 17:34 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-07 17:34 net/ipv4/tcp_metrics.c:1006:41: warning: The result of the left shift is undefined due to shifting by '64', which is greater or equal to the width of type 'unsigned long' [clang-analyzer-core.UndefinedBinaryOperatorResult] 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.