]> git.baikalelectronics.ru Git - kernel.git/commitdiff
flow_dissector: fix false-positive __read_overflow2_field() warning
authorJakub Kicinski <kuba@kernel.org>
Wed, 6 Apr 2022 21:15:21 +0000 (14:15 -0700)
committerDavid S. Miller <davem@davemloft.net>
Fri, 8 Apr 2022 11:16:59 +0000 (12:16 +0100)
Bounds checking is unhappy that we try to copy both Ethernet
addresses but pass pointer to the first one. Luckily destination
address is the first field so pass the pointer to the entire header,
whatever.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Reviewed-by: Kees Cook <keescook@chromium.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/core/flow_dissector.c

index 9bd887610c18f4606191dd51601f0fa33c55c2bc..6f7ec72016dcd5e0caa90ea631d06317e667d8d7 100644 (file)
@@ -1032,7 +1032,7 @@ bool __skb_flow_dissect(const struct net *net,
                key_eth_addrs = skb_flow_dissector_target(flow_dissector,
                                                          FLOW_DISSECTOR_KEY_ETH_ADDRS,
                                                          target_container);
-               memcpy(key_eth_addrs, &eth->h_dest, sizeof(*key_eth_addrs));
+               memcpy(key_eth_addrs, eth, sizeof(*key_eth_addrs));
        }
 
 proto_again: