Subject: Re: [PATCH ipsec 1/2] xfrm: extract dst lookup parameters into a struct

From: Simon Horman <[email-masked]>
Date: Mon, 2 Sep 2024 10:32:07 +0100

On Sun, Sep 01, 2024 at 04:57:36PM -0700, Eyal Birger wrote:
> Preparation for adding more fields to dst lookup functions without
> changing their signatures.
> 
> Signed-off-by: Eyal Birger <[email-masked]>

...

> diff --git a/net/xfrm/xfrm_device.c b/net/xfrm/xfrm_device.c

...

> @@ -277,9 +279,12 @@ int xfrm_dev_state_add(struct net *net, struct xfrm_state *x,
>  			daddr = &x->props.saddr;
>  		}
>  
> -		dst = __xfrm_dst_lookup(net, 0, 0, saddr, daddr,
> -					x->props.family,
> -					xfrm_smark_get(0, x));
> +		memset(&params, 0, sizeof(params));
> +		params.net = net;
> +		params.saddr = saddr;
> +		params.daddr = saddr;

Hi Eyal,

Should this be: params.daddr = daddr;
                               ^^^^^

daddr is flagged as set but otherwise unused by W=1 allmodconfig builds.

> +		params.mark = xfrm_smark_get(0, x);
> +		dst = __xfrm_dst_lookup(x->props.family, &params);
>  		if (IS_ERR(dst))
>  			return (is_packet_offload) ? -EINVAL : 0;
>