diff mbox series

[PATCH-net] batman-adv: Fix "Arguments in wrong order" issue

Message ID 20241115045637.15481-1-dheeraj.linuxdev@gmail.com (mailing list archive)
State New
Delegated to: Netdev Maintainers
Headers show
Series [PATCH-net] batman-adv: Fix "Arguments in wrong order" issue | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for net
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present fail Series targets non-next tree, but doesn't contain any Fixes tags
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 3 this patch: 3
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers success CCed 10 of 10 maintainers
netdev/build_clang success Errors and warnings before: 3 this patch: 3
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 4 this patch: 4
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 8 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Dheeraj Reddy Jonnalagadda Nov. 15, 2024, 4:56 a.m. UTC
This commit fixes an "Arguments in wrong order" issue detected by
Coverity (CID 1376875).

Signed-off-by: Dheeraj Reddy Jonnalagadda <dheeraj.linuxdev@gmail.com>
---
 net/batman-adv/distributed-arp-table.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Sven Eckelmann Nov. 15, 2024, 7:14 a.m. UTC | #1
On Friday, 15 November 2024 05:56:37 CET Dheeraj Reddy Jonnalagadda wrote:
> This commit fixes an "Arguments in wrong order" issue detected by
> Coverity (CID 1376875).
> 
> Signed-off-by: Dheeraj Reddy Jonnalagadda <dheeraj.linuxdev@gmail.com>
> ---
>  net/batman-adv/distributed-arp-table.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/net/batman-adv/distributed-arp-table.c b/net/batman-adv/
distributed-arp-table.c
> index 801eff8a40e5..781a5118d441 100644
> --- a/net/batman-adv/distributed-arp-table.c
> +++ b/net/batman-adv/distributed-arp-table.c
> @@ -1195,7 +1195,7 @@ bool batadv_dat_snoop_outgoing_arp_request(struct 
batadv_priv *bat_priv,
>  			goto out;
>  		}
>  
> -		skb_new = batadv_dat_arp_create_reply(bat_priv, ip_dst, 
ip_src,
> +		skb_new = batadv_dat_arp_create_reply(bat_priv, ip_src, 
ip_dst,
>  						      
dat_entry->mac_addr,
>  						      
hw_src, vid);
>  		if (!skb_new)
> 

Sorry, but this is wrong. We send an answer here ("ARP request 
replied locally") and of course we must then switch src and destination. 
Otherwise we would send the ARP response to the entity which didn't requested 
it.

This was already marked as false positive in Coverity a long time ago.

Kind regards,
	Sven
diff mbox series

Patch

diff --git a/net/batman-adv/distributed-arp-table.c b/net/batman-adv/distributed-arp-table.c
index 801eff8a40e5..781a5118d441 100644
--- a/net/batman-adv/distributed-arp-table.c
+++ b/net/batman-adv/distributed-arp-table.c
@@ -1195,7 +1195,7 @@  bool batadv_dat_snoop_outgoing_arp_request(struct batadv_priv *bat_priv,
 			goto out;
 		}
 
-		skb_new = batadv_dat_arp_create_reply(bat_priv, ip_dst, ip_src,
+		skb_new = batadv_dat_arp_create_reply(bat_priv, ip_src, ip_dst,
 						      dat_entry->mac_addr,
 						      hw_src, vid);
 		if (!skb_new)