:::::: :::::: Manual check reason: "low confidence static check warning: net/netfilter/nf_flow_table_offload.c:977:4: warning: Dereference of null pointer [clang-analyzer-core.NullDereference]" ::::::
CC: l...@lists.linux.dev CC: kbuild-...@lists.01.org BCC: l...@intel.com In-Reply-To: <20220615104355.391249-3-vla...@nvidia.com> References: <20220615104355.391249-3-vla...@nvidia.com> TO: Vlad Buslov <vla...@nvidia.com> Hi Vlad, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on net-next/master] url: https://github.com/intel-lab-lkp/linux/commits/Vlad-Buslov/Conntrack-offload-debuggability-improvements/20220615-184515 base: https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git 2aa4abed37927b9bc5db60dd5d440a7a47435a92 :::::: branch date: 3 weeks ago :::::: commit date: 3 weeks ago config: s390-randconfig-c005-20220702 (https://download.01.org/0day-ci/archive/20220706/202207061421.5k9tk70m-...@intel.com/config) compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project f7a80c3d08d4821e621fc88d6a2e435291f82dff) 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 s390 cross compiling tool for clang build # apt-get install binutils-s390x-linux-gnu # https://github.com/intel-lab-lkp/linux/commit/eafef8f9ece19a17faae9a2c1a3343b7eb8caefb git remote add linux-review https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review Vlad-Buslov/Conntrack-offload-debuggability-improvements/20220615-184515 git checkout eafef8f9ece19a17faae9a2c1a3343b7eb8caefb # save the config file COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=s390 clang-analyzer If you fix the issue, kindly add following tag where applicable Reported-by: kernel test robot <l...@intel.com> clang-analyzer warnings: (new ones prefixed by >>) ^ include/linux/netdevice.h:3937:3: note: Loop condition is false. Exiting loop this_cpu_dec(*dev->pcpu_refcnt); ^ include/linux/percpu-defs.h:521:28: note: expanded from macro 'this_cpu_dec' #define this_cpu_dec(pcp) this_cpu_sub(pcp, 1) ^ include/linux/percpu-defs.h:519:33: note: expanded from macro 'this_cpu_sub' #define this_cpu_sub(pcp, val) this_cpu_add(pcp, -(typeof(pcp))(val)) ^ include/linux/percpu-defs.h:509:33: note: expanded from macro 'this_cpu_add' #define this_cpu_add(pcp, val) __pcpu_size_call(this_cpu_add_, pcp, val) ^ include/linux/percpu-defs.h:375:2: note: expanded from macro '__pcpu_size_call' __verify_pcpu_ptr(&(variable)); \ ^ include/linux/percpu-defs.h:217:37: note: expanded from macro '__verify_pcpu_ptr' #define __verify_pcpu_ptr(ptr) \ ^ include/linux/netdevice.h:3937:3: note: Control jumps to 'case 4:' at line 3937 this_cpu_dec(*dev->pcpu_refcnt); ^ include/linux/percpu-defs.h:521:28: note: expanded from macro 'this_cpu_dec' #define this_cpu_dec(pcp) this_cpu_sub(pcp, 1) ^ include/linux/percpu-defs.h:519:33: note: expanded from macro 'this_cpu_sub' #define this_cpu_sub(pcp, val) this_cpu_add(pcp, -(typeof(pcp))(val)) ^ include/linux/percpu-defs.h:509:33: note: expanded from macro 'this_cpu_add' #define this_cpu_add(pcp, val) __pcpu_size_call(this_cpu_add_, pcp, val) ^ include/linux/percpu-defs.h:376:2: note: expanded from macro '__pcpu_size_call' switch(sizeof(variable)) { \ ^ include/linux/netdevice.h:3937:3: note: Loop condition is false. Exiting loop this_cpu_dec(*dev->pcpu_refcnt); ^ include/linux/percpu-defs.h:521:28: note: expanded from macro 'this_cpu_dec' #define this_cpu_dec(pcp) this_cpu_sub(pcp, 1) ^ include/linux/percpu-defs.h:519:33: note: expanded from macro 'this_cpu_sub' #define this_cpu_sub(pcp, val) this_cpu_add(pcp, -(typeof(pcp))(val)) ^ include/linux/percpu-defs.h:509:33: note: expanded from macro 'this_cpu_add' #define this_cpu_add(pcp, val) __pcpu_size_call(this_cpu_add_, pcp, val) ^ note: (skipping 2 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all) arch/s390/include/asm/percpu.h:90:34: note: expanded from macro 'this_cpu_add_4' #define this_cpu_add_4(pcp, val) arch_this_cpu_add(pcp, val, "laa", "asi", int) ^ arch/s390/include/asm/percpu.h:71:2: note: expanded from macro 'arch_this_cpu_add' preempt_disable_notrace(); \ ^ include/linux/preempt.h:254:35: note: expanded from macro 'preempt_disable_notrace' #define preempt_disable_notrace() \ ^ include/linux/netdevice.h:3937:3: note: Loop condition is false. Exiting loop this_cpu_dec(*dev->pcpu_refcnt); ^ include/linux/percpu-defs.h:521:28: note: expanded from macro 'this_cpu_dec' #define this_cpu_dec(pcp) this_cpu_sub(pcp, 1) ^ include/linux/percpu-defs.h:519:33: note: expanded from macro 'this_cpu_sub' #define this_cpu_sub(pcp, val) this_cpu_add(pcp, -(typeof(pcp))(val)) ^ include/linux/percpu-defs.h:509:33: note: expanded from macro 'this_cpu_add' #define this_cpu_add(pcp, val) __pcpu_size_call(this_cpu_add_, pcp, val) ^ note: (skipping 3 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all) arch/s390/include/asm/percpu.h:72:10: note: expanded from macro 'arch_this_cpu_add' ptr__ = raw_cpu_ptr(&(pcp)); \ ^ include/linux/percpu-defs.h:241:2: note: expanded from macro 'raw_cpu_ptr' __verify_pcpu_ptr(ptr); \ ^ include/linux/percpu-defs.h:217:37: note: expanded from macro '__verify_pcpu_ptr' #define __verify_pcpu_ptr(ptr) \ ^ include/linux/netdevice.h:3937:3: note: Dereference of null pointer this_cpu_dec(*dev->pcpu_refcnt); ^ include/linux/percpu-defs.h:521:28: note: expanded from macro 'this_cpu_dec' #define this_cpu_dec(pcp) this_cpu_sub(pcp, 1) ^~~~~~~~~~~~~~~~~~~~ include/linux/percpu-defs.h:519:33: note: expanded from macro 'this_cpu_sub' #define this_cpu_sub(pcp, val) this_cpu_add(pcp, -(typeof(pcp))(val)) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/percpu-defs.h:509:33: note: expanded from macro 'this_cpu_add' #define this_cpu_add(pcp, val) __pcpu_size_call(this_cpu_add_, pcp, val) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ note: (skipping 5 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all) include/asm-generic/percpu.h:44:31: note: expanded from macro 'arch_raw_cpu_ptr' #define arch_raw_cpu_ptr(ptr) SHIFT_PERCPU_PTR(ptr, __my_cpu_offset) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/percpu-defs.h:231:2: note: expanded from macro 'SHIFT_PERCPU_PTR' RELOC_HIDE((typeof(*(__p)) __kernel __force *)(__p), (__offset)) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/compiler.h:170:28: note: expanded from macro 'RELOC_HIDE' (typeof(ptr)) (__ptr + (off)); }) ^~~~~ >> net/netfilter/nf_flow_table_offload.c:977:4: warning: Dereference of null >> pointer [clang-analyzer-core.NullDereference] NF_FLOW_TABLE_STAT_DEC_ATOMIC(net, count_wq_add); ^ include/net/netfilter/nf_flow_table.h:343:2: note: expanded from macro 'NF_FLOW_TABLE_STAT_DEC_ATOMIC' this_cpu_dec((net)->ft.stat->count) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/percpu-defs.h:521:28: note: expanded from macro 'this_cpu_dec' #define this_cpu_dec(pcp) this_cpu_sub(pcp, 1) ^~~~~~~~~~~~~~~~~~~~ include/linux/percpu-defs.h:519:33: note: expanded from macro 'this_cpu_sub' #define this_cpu_sub(pcp, val) this_cpu_add(pcp, -(typeof(pcp))(val)) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ note: (skipping 6 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all) include/asm-generic/percpu.h:44:31: note: expanded from macro 'arch_raw_cpu_ptr' #define arch_raw_cpu_ptr(ptr) SHIFT_PERCPU_PTR(ptr, __my_cpu_offset) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/percpu-defs.h:231:2: note: expanded from macro 'SHIFT_PERCPU_PTR' RELOC_HIDE((typeof(*(__p)) __kernel __force *)(__p), (__offset)) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/compiler.h:170:28: note: expanded from macro 'RELOC_HIDE' (typeof(ptr)) (__ptr + (off)); }) ^~~~~ net/netfilter/nf_flow_table_offload.c:974:2: note: Control jumps to 'case FLOW_CLS_REPLACE:' at line 975 switch (offload->cmd) { ^ net/netfilter/nf_flow_table_offload.c:977:4: note: Loop condition is false. Exiting loop NF_FLOW_TABLE_STAT_DEC_ATOMIC(net, count_wq_add); ^ include/net/netfilter/nf_flow_table.h:343:2: note: expanded from macro 'NF_FLOW_TABLE_STAT_DEC_ATOMIC' this_cpu_dec((net)->ft.stat->count) ^ include/linux/percpu-defs.h:521:28: note: expanded from macro 'this_cpu_dec' #define this_cpu_dec(pcp) this_cpu_sub(pcp, 1) ^ include/linux/percpu-defs.h:519:33: note: expanded from macro 'this_cpu_sub' #define this_cpu_sub(pcp, val) this_cpu_add(pcp, -(typeof(pcp))(val)) ^ include/linux/percpu-defs.h:509:33: note: expanded from macro 'this_cpu_add' #define this_cpu_add(pcp, val) __pcpu_size_call(this_cpu_add_, pcp, val) ^ include/linux/percpu-defs.h:375:2: note: expanded from macro '__pcpu_size_call' __verify_pcpu_ptr(&(variable)); \ ^ include/linux/percpu-defs.h:217:37: note: expanded from macro '__verify_pcpu_ptr' #define __verify_pcpu_ptr(ptr) \ ^ net/netfilter/nf_flow_table_offload.c:977:4: note: Control jumps to 'case 4:' at line 977 NF_FLOW_TABLE_STAT_DEC_ATOMIC(net, count_wq_add); ^ include/net/netfilter/nf_flow_table.h:343:2: note: expanded from macro 'NF_FLOW_TABLE_STAT_DEC_ATOMIC' this_cpu_dec((net)->ft.stat->count) ^ include/linux/percpu-defs.h:521:28: note: expanded from macro 'this_cpu_dec' #define this_cpu_dec(pcp) this_cpu_sub(pcp, 1) ^ include/linux/percpu-defs.h:519:33: note: expanded from macro 'this_cpu_sub' #define this_cpu_sub(pcp, val) this_cpu_add(pcp, -(typeof(pcp))(val)) ^ include/linux/percpu-defs.h:509:33: note: expanded from macro 'this_cpu_add' #define this_cpu_add(pcp, val) __pcpu_size_call(this_cpu_add_, pcp, val) ^ include/linux/percpu-defs.h:376:2: note: expanded from macro '__pcpu_size_call' switch(sizeof(variable)) { \ ^ net/netfilter/nf_flow_table_offload.c:977:4: note: Loop condition is false. Exiting loop NF_FLOW_TABLE_STAT_DEC_ATOMIC(net, count_wq_add); ^ include/net/netfilter/nf_flow_table.h:343:2: note: expanded from macro 'NF_FLOW_TABLE_STAT_DEC_ATOMIC' this_cpu_dec((net)->ft.stat->count) ^ include/linux/percpu-defs.h:521:28: note: expanded from macro 'this_cpu_dec' #define this_cpu_dec(pcp) this_cpu_sub(pcp, 1) ^ include/linux/percpu-defs.h:519:33: note: expanded from macro 'this_cpu_sub' #define this_cpu_sub(pcp, val) this_cpu_add(pcp, -(typeof(pcp))(val)) ^ note: (skipping 3 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all) arch/s390/include/asm/percpu.h:90:34: note: expanded from macro 'this_cpu_add_4' #define this_cpu_add_4(pcp, val) arch_this_cpu_add(pcp, val, "laa", "asi", int) ^ arch/s390/include/asm/percpu.h:71:2: note: expanded from macro 'arch_this_cpu_add' preempt_disable_notrace(); \ ^ include/linux/preempt.h:254:35: note: expanded from macro 'preempt_disable_notrace' #define preempt_disable_notrace() \ ^ net/netfilter/nf_flow_table_offload.c:977:4: note: Loop condition is false. Exiting loop NF_FLOW_TABLE_STAT_DEC_ATOMIC(net, count_wq_add); ^ include/net/netfilter/nf_flow_table.h:343:2: note: expanded from macro 'NF_FLOW_TABLE_STAT_DEC_ATOMIC' this_cpu_dec((net)->ft.stat->count) ^ include/linux/percpu-defs.h:521:28: note: expanded from macro 'this_cpu_dec' #define this_cpu_dec(pcp) this_cpu_sub(pcp, 1) ^ include/linux/percpu-defs.h:519:33: note: expanded from macro 'this_cpu_sub' #define this_cpu_sub(pcp, val) this_cpu_add(pcp, -(typeof(pcp))(val)) ^ note: (skipping 4 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all) arch/s390/include/asm/percpu.h:72:10: note: expanded from macro 'arch_this_cpu_add' ptr__ = raw_cpu_ptr(&(pcp)); \ vim +977 net/netfilter/nf_flow_table_offload.c c29f74e0df7a02 Pablo Neira Ayuso 2019-11-12 966 c29f74e0df7a02 Pablo Neira Ayuso 2019-11-12 967 static void flow_offload_work_handler(struct work_struct *work) c29f74e0df7a02 Pablo Neira Ayuso 2019-11-12 968 { 7da182a998d6cf Paul Blakey 2020-03-27 969 struct flow_offload_work *offload; eafef8f9ece19a Vlad Buslov 2022-06-15 970 struct net *net; c29f74e0df7a02 Pablo Neira Ayuso 2019-11-12 971 7da182a998d6cf Paul Blakey 2020-03-27 972 offload = container_of(work, struct flow_offload_work, work); eafef8f9ece19a Vlad Buslov 2022-06-15 973 net = read_pnet(&offload->flowtable->net); c29f74e0df7a02 Pablo Neira Ayuso 2019-11-12 974 switch (offload->cmd) { c29f74e0df7a02 Pablo Neira Ayuso 2019-11-12 975 case FLOW_CLS_REPLACE: f698fe40829b21 Pablo Neira Ayuso 2020-01-06 976 flow_offload_work_add(offload); eafef8f9ece19a Vlad Buslov 2022-06-15 @977 NF_FLOW_TABLE_STAT_DEC_ATOMIC(net, count_wq_add); c29f74e0df7a02 Pablo Neira Ayuso 2019-11-12 978 break; c29f74e0df7a02 Pablo Neira Ayuso 2019-11-12 979 case FLOW_CLS_DESTROY: c29f74e0df7a02 Pablo Neira Ayuso 2019-11-12 980 flow_offload_work_del(offload); eafef8f9ece19a Vlad Buslov 2022-06-15 981 NF_FLOW_TABLE_STAT_DEC_ATOMIC(net, count_wq_del); c29f74e0df7a02 Pablo Neira Ayuso 2019-11-12 982 break; c29f74e0df7a02 Pablo Neira Ayuso 2019-11-12 983 case FLOW_CLS_STATS: c29f74e0df7a02 Pablo Neira Ayuso 2019-11-12 984 flow_offload_work_stats(offload); eafef8f9ece19a Vlad Buslov 2022-06-15 985 NF_FLOW_TABLE_STAT_DEC_ATOMIC(net, count_wq_stats); c29f74e0df7a02 Pablo Neira Ayuso 2019-11-12 986 break; c29f74e0df7a02 Pablo Neira Ayuso 2019-11-12 987 default: c29f74e0df7a02 Pablo Neira Ayuso 2019-11-12 988 WARN_ON_ONCE(1); c29f74e0df7a02 Pablo Neira Ayuso 2019-11-12 989 } 7da182a998d6cf Paul Blakey 2020-03-27 990 2c8897953f3b2f Paul Blakey 2020-05-06 991 clear_bit(NF_FLOW_HW_PENDING, &offload->flow->flags); c29f74e0df7a02 Pablo Neira Ayuso 2019-11-12 992 kfree(offload); c29f74e0df7a02 Pablo Neira Ayuso 2019-11-12 993 } c29f74e0df7a02 Pablo Neira Ayuso 2019-11-12 994 -- 0-DAY CI Kernel Test Service https://01.org/lkp _______________________________________________ kbuild mailing list -- kbuild@lists.01.org To unsubscribe send an email to kbuild-le...@lists.01.org