diff mbox series

[net] flow_dissector: fix false-positive __read_overflow2_field() warning

Message ID 20220406211521.723357-1-kuba@kernel.org (mailing list archive)
State Accepted
Commit 1b808993e19447731e823b1313ee4e8da7fd92a0
Delegated to: Netdev Maintainers
Headers show
Series [net] flow_dissector: fix false-positive __read_overflow2_field() warning | expand

Checks

Context Check Description
netdev/tree_selection success Clearly marked for net
netdev/fixes_present fail Series targets non-next tree, but doesn't contain any Fixes tags
netdev/subject_prefix success Link
netdev/cover_letter success Single patches do not need cover letters
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 3 this patch: 2
netdev/cc_maintainers warning 1 maintainers not CCed: zhangkaiheb@126.com
netdev/build_clang success Errors and warnings before: 9 this patch: 9
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 3 this patch: 2
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 8 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Jakub Kicinski April 6, 2022, 9:15 p.m. UTC
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>
---
I feel like we talked about this one.
I wonder if my position now is consistent with what I said
in the past :)

 net/core/flow_dissector.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Kees Cook April 6, 2022, 9:36 p.m. UTC | #1
On Wed, Apr 06, 2022 at 02:15:21PM -0700, Jakub Kicinski wrote:
> 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>

Ah yes, thanks! I had prepared this patch last week, but failed to
actually send it. :|

Reviewed-by: Kees Cook <keescook@chromium.org>
patchwork-bot+netdevbpf@kernel.org April 8, 2022, 11:20 a.m. UTC | #2
Hello:

This patch was applied to netdev/net.git (master)
by David S. Miller <davem@davemloft.net>:

On Wed,  6 Apr 2022 14:15:21 -0700 you wrote:
> 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>
> 
> [...]

Here is the summary with links:
  - [net] flow_dissector: fix false-positive __read_overflow2_field() warning
    https://git.kernel.org/netdev/net/c/1b808993e194

You are awesome, thank you!
diff mbox series

Patch

diff --git a/net/core/flow_dissector.c b/net/core/flow_dissector.c
index 03b6e649c428..912bda212db2 100644
--- a/net/core/flow_dissector.c
+++ b/net/core/flow_dissector.c
@@ -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: