net//netfilter/nf_nat_core.c:810:2: note: in expansion of macro 'if'

From: kbuild test robot
Date: Sat Sep 16 2017 - 23:33:13 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 2bd6bf03f4c1c59381d62c61d03f6cc3fe71f66e
commit: 8073e960a03bf7b5d5ebfc5ff18ac475e1688f46 netfilter: nat: use keyed locks
date: 8 days ago
config: x86_64-randconfig-s4-09170918 (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
git checkout 8073e960a03bf7b5d5ebfc5ff18ac475e1688f46
# save the attached .config to linux build tree
make ARCH=x86_64

All warnings (new ones prefixed by >>):

In file included from include/linux/list.h:8:0,
from include/linux/module.h:9,
from net//netfilter/nf_nat_core.c:11:
net//netfilter/nf_nat_core.c: In function 'nf_nat_setup_info':
include/linux/kernel.h:60:38: warning: division by zero [-Wdiv-by-zero]
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
^
net//netfilter/nf_nat_core.c:432:34: note: in expansion of macro 'ARRAY_SIZE'
lock = &nf_nat_locks[srchash % ARRAY_SIZE(nf_nat_locks)];
^~~~~~~~~~
net//netfilter/nf_nat_core.c: In function '__nf_nat_cleanup_conntrack':
include/linux/kernel.h:60:38: warning: division by zero [-Wdiv-by-zero]
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
^
net//netfilter/nf_nat_core.c:535:33: note: in expansion of macro 'ARRAY_SIZE'
spin_lock_bh(&nf_nat_locks[h % ARRAY_SIZE(nf_nat_locks)]);
^~~~~~~~~~
include/linux/kernel.h:60:38: warning: division by zero [-Wdiv-by-zero]
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
^
net//netfilter/nf_nat_core.c:537:35: note: in expansion of macro 'ARRAY_SIZE'
spin_unlock_bh(&nf_nat_locks[h % ARRAY_SIZE(nf_nat_locks)]);
^~~~~~~~~~
In file included from include/uapi/linux/stddef.h:1:0,
from include/linux/stddef.h:4,
from include/uapi/linux/posix_types.h:4,
from include/uapi/linux/types.h:13,
from include/linux/types.h:5,
from include/linux/list.h:4,
from include/linux/module.h:9,
from net//netfilter/nf_nat_core.c:11:
net//netfilter/nf_nat_core.c: In function 'nf_nat_init':
include/linux/kernel.h:60:38: warning: division by zero [-Wdiv-by-zero]
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
^
include/linux/compiler.h:156:30: note: in definition of macro '__trace_if'
if (__builtin_constant_p(!!(cond)) ? !!(cond) : \
^~~~
>> net//netfilter/nf_nat_core.c:810:2: note: in expansion of macro 'if'
if (nf_nat_htable_size < ARRAY_SIZE(nf_nat_locks))
^~
net//netfilter/nf_nat_core.c:810:27: note: in expansion of macro 'ARRAY_SIZE'
if (nf_nat_htable_size < ARRAY_SIZE(nf_nat_locks))
^~~~~~~~~~
include/linux/kernel.h:60:38: warning: division by zero [-Wdiv-by-zero]
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
^
include/linux/compiler.h:156:42: note: in definition of macro '__trace_if'
if (__builtin_constant_p(!!(cond)) ? !!(cond) : \
^~~~
>> net//netfilter/nf_nat_core.c:810:2: note: in expansion of macro 'if'
if (nf_nat_htable_size < ARRAY_SIZE(nf_nat_locks))
^~
net//netfilter/nf_nat_core.c:810:27: note: in expansion of macro 'ARRAY_SIZE'
if (nf_nat_htable_size < ARRAY_SIZE(nf_nat_locks))
^~~~~~~~~~
include/linux/kernel.h:60:38: warning: division by zero [-Wdiv-by-zero]
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
^
include/linux/compiler.h:167:16: note: in definition of macro '__trace_if'
______r = !!(cond); \
^~~~
>> net//netfilter/nf_nat_core.c:810:2: note: in expansion of macro 'if'
if (nf_nat_htable_size < ARRAY_SIZE(nf_nat_locks))
^~
net//netfilter/nf_nat_core.c:810:27: note: in expansion of macro 'ARRAY_SIZE'
if (nf_nat_htable_size < ARRAY_SIZE(nf_nat_locks))
^~~~~~~~~~
In file included from include/linux/list.h:8:0,
from include/linux/module.h:9,
from net//netfilter/nf_nat_core.c:11:
include/linux/kernel.h:60:38: warning: division by zero [-Wdiv-by-zero]
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
^
net//netfilter/nf_nat_core.c:811:24: note: in expansion of macro 'ARRAY_SIZE'
nf_nat_htable_size = ARRAY_SIZE(nf_nat_locks);
^~~~~~~~~~
include/linux/kernel.h:60:38: warning: division by zero [-Wdiv-by-zero]
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
^
net//netfilter/nf_nat_core.c:824:18: note: in expansion of macro 'ARRAY_SIZE'
for (i = 0; i < ARRAY_SIZE(nf_nat_locks); i++)
^~~~~~~~~~
In file included from include/uapi/linux/stddef.h:1:0,
from include/linux/stddef.h:4,
from include/uapi/linux/posix_types.h:4,
from include/uapi/linux/types.h:13,
from include/linux/types.h:5,
from include/linux/list.h:4,
from include/linux/module.h:9,
from net//netfilter/nf_nat_core.c:11:
net//netfilter/nf_nat_core.c: At top level:
include/linux/compiler.h:162:4: warning: '______f' is static but declared in inline function 'strcpy' which is not static
______f = { \
^
include/linux/compiler.h:154:23: note: in expansion of macro '__trace_if'
#define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
^~~~~~~~~~
include/linux/string.h:390:2: note: in expansion of macro 'if'
if (p_size == (size_t)-1 && q_size == (size_t)-1)
^~
include/linux/compiler.h:162:4: warning: '______f' is static but declared in inline function 'kmemdup' which is not static
______f = { \
^
include/linux/compiler.h:154:23: note: in expansion of macro '__trace_if'
#define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
^~~~~~~~~~
include/linux/string.h:380:2: note: in expansion of macro 'if'
if (p_size < size)
^~
include/linux/compiler.h:162:4: warning: '______f' is static but declared in inline function 'kmemdup' which is not static
______f = { \
^
include/linux/compiler.h:154:23: note: in expansion of macro '__trace_if'
#define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
^~~~~~~~~~
include/linux/string.h:378:2: note: in expansion of macro 'if'
if (__builtin_constant_p(size) && p_size < size)
^~
include/linux/compiler.h:162:4: warning: '______f' is static but declared in inline function 'memchr_inv' which is not static
______f = { \
^
include/linux/compiler.h:154:23: note: in expansion of macro '__trace_if'
#define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
^~~~~~~~~~
include/linux/string.h:369:2: note: in expansion of macro 'if'
if (p_size < size)
^~
include/linux/compiler.h:162:4: warning: '______f' is static but declared in inline function 'memchr_inv' which is not static
______f = { \
^
include/linux/compiler.h:154:23: note: in expansion of macro '__trace_if'
#define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
^~~~~~~~~~
include/linux/string.h:367:2: note: in expansion of macro 'if'
if (__builtin_constant_p(size) && p_size < size)
^~
include/linux/compiler.h:162:4: warning: '______f' is static but declared in inline function 'memchr' which is not static
______f = { \
^
include/linux/compiler.h:154:23: note: in expansion of macro '__trace_if'
#define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
^~~~~~~~~~
include/linux/string.h:358:2: note: in expansion of macro 'if'
if (p_size < size)
^~
include/linux/compiler.h:162:4: warning: '______f' is static but declared in inline function 'memchr' which is not static
______f = { \
^
include/linux/compiler.h:154:23: note: in expansion of macro '__trace_if'
#define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
^~~~~~~~~~
include/linux/string.h:356:2: note: in expansion of macro 'if'
if (__builtin_constant_p(size) && p_size < size)
^~
include/linux/compiler.h:162:4: warning: '______f' is static but declared in inline function 'memcmp' which is not static
______f = { \
^
include/linux/compiler.h:154:23: note: in expansion of macro '__trace_if'
#define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
^~~~~~~~~~
include/linux/string.h:348:2: note: in expansion of macro 'if'
if (p_size < size || q_size < size)

vim +/if +810 net//netfilter/nf_nat_core.c

803
804 static int __init nf_nat_init(void)
805 {
806 int ret, i;
807
808 /* Leave them the same for the moment. */
809 nf_nat_htable_size = nf_conntrack_htable_size;
> 810 if (nf_nat_htable_size < ARRAY_SIZE(nf_nat_locks))
811 nf_nat_htable_size = ARRAY_SIZE(nf_nat_locks);
812
813 nf_nat_bysource = nf_ct_alloc_hashtable(&nf_nat_htable_size, 0);
814 if (!nf_nat_bysource)
815 return -ENOMEM;
816
817 ret = nf_ct_extend_register(&nat_extend);
818 if (ret < 0) {
819 nf_ct_free_hashtable(nf_nat_bysource, nf_nat_htable_size);
820 printk(KERN_ERR "nf_nat_core: Unable to register extension\n");
821 return ret;
822 }
823
824 for (i = 0; i < ARRAY_SIZE(nf_nat_locks); i++)
825 spin_lock_init(&nf_nat_locks[i]);
826
827 nf_ct_helper_expectfn_register(&follow_master_nat);
828
829 BUG_ON(nfnetlink_parse_nat_setup_hook != NULL);
830 RCU_INIT_POINTER(nfnetlink_parse_nat_setup_hook,
831 nfnetlink_parse_nat_setup);
832 #ifdef CONFIG_XFRM
833 BUG_ON(nf_nat_decode_session_hook != NULL);
834 RCU_INIT_POINTER(nf_nat_decode_session_hook, __nf_nat_decode_session);
835 #endif
836 return 0;
837 }
838

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

Attachment: .config.gz
Description: application/gzip