]> git.baikalelectronics.ru Git - kernel.git/commit
netfilter: nf_flow_table_offload: Don't use offset uninitialized in flow_offload_port...
authorNathan Chancellor <natechancellor@gmail.com>
Tue, 26 Nov 2019 20:12:26 +0000 (13:12 -0700)
committerPablo Neira Ayuso <pablo@netfilter.org>
Sat, 30 Nov 2019 18:45:40 +0000 (19:45 +0100)
commitf129f2ba027c83256de508eae5b4fd4a83c978e8
tree7384db77da5b8450aeeaf1c021770f916d5f063f
parent85986956e2a695503ed738351d84e51865bc0640
netfilter: nf_flow_table_offload: Don't use offset uninitialized in flow_offload_port_{d,s}nat

Clang warns (trimmed the second warning for brevity):

../net/netfilter/nf_flow_table_offload.c:342:2: warning: variable
'offset' is used uninitialized whenever switch default is taken
[-Wsometimes-uninitialized]
        default:
        ^~~~~~~
../net/netfilter/nf_flow_table_offload.c:346:57: note: uninitialized use
occurs here
        flow_offload_mangle(entry, flow_offload_l4proto(flow), offset,
                                                               ^~~~~~
../net/netfilter/nf_flow_table_offload.c:331:12: note: initialize the
variable 'offset' to silence this warning
        u32 offset;
                  ^
                   = 0

Match what was done in the flow_offload_ipv{4,6}_{d,s}nat functions and
just return in the default case, since port would also be uninitialized.

Fixes: 3029814930c4 ("netfilter: nf_flow_table: hardware offload support")
Link: https://github.com/ClangBuiltLinux/linux/issues/780
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Reported-by: kernelci.org bot <bot@kernelci.org>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
net/netfilter/nf_flow_table_offload.c