Skip to contentSkip to conversation

flow_dissector: fix false-positive __read_overflow2_field() warning

PATCH Applied Jakub Kicinski 3 participants 3 messages Apr 6, 2022 – Apr 8, 2022

Subsystems (2)
lore
Share & tools
lore

Jakub Kicinski

author maintainer
#0 lore raw

PATCH 1/1 flow_dissector: fix false-positive __read_overflow2_field() warning

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.

---
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(-)
net/core/flow_dissector.c +1 -1
index 03b6e649c428..912bda212db2 100644
@@ -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:
Signature · 1 line
2.34.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Jakub Kicinski

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.

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

Signature · 1 line
Kees Cook
#2 lore raw
In reply to Jakub Kicinski
This patch was applied to netdev/net.git (master) by David S. Miller <[email protected]>:

Hello:

This patch was applied to netdev/net.git (master)
by David S. Miller <[email protected]>:

Quoted 8 lines · 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.

[...]

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!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html