[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <693b94d6-eece-9334-4157-69f562836f3a@gmail.com>
Date: Fri, 17 Jan 2020 14:17:37 -0800
From: Eric Dumazet <eric.dumazet@...il.com>
To: Jeff Kirsher <jeffrey.t.kirsher@...el.com>, davem@...emloft.net
Cc: netdev@...r.kernel.org
Subject: Re: [RFC net-next PATCH] ipv6: New define for reoccurring code
On 1/17/20 1:56 PM, Jeff Kirsher wrote:
> Through out the kernel, sizeof() is used to determine the size of the IPv6
> address structure, so create a define for the commonly used code.
>
> s/sizeof(struct in6_addr)/ipv6_addr_size/g
>
> This is just a portion of the instances in the kernel and before cleaning
> up all the occurrences, wanted to make sure that this was a desired change
> or if this obfuscates the code.
>
> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@...el.com>
> ---
...
> };
> +#define ipv6_addr_size sizeof(struct in6_addr)
> #endif /* __UAPI_DEF_IN6_ADDR */
>
> #if __UAPI_DEF_SOCKADDR_IN6
> diff --git a/net/core/filter.c b/net/core/filter.c
> index ef01c5599501..eabf42893b60 100644
> --- a/net/core/filter.c
> +++ b/net/core/filter.c
> @@ -5053,7 +5053,7 @@ BPF_CALL_4(bpf_lwt_seg6_action, struct sk_buff *, skb,
> case SEG6_LOCAL_ACTION_END_X:
> if (!seg6_bpf_has_valid_srh(skb))
> return -EBADMSG;
> - if (param_len != sizeof(struct in6_addr))
> + if (param_len != ipv6_addr_size)
Hmm...
I vote seeing sizeof(struct in6_addr) rather than dealing
with yet another thing to remember and additional backports conflicts.
And I prefer not seeing dozens of followup trivial patches because
people will forget about this new pseudo variable.
Powered by blists - more mailing lists