lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAADnVQ+cnMrDcaGMg4ojawdW_N0Ga1rim2wrFWavbg1FG4GNMA@mail.gmail.com>
Date:   Fri, 17 Jan 2020 15:36:30 -0800
From:   Alexei Starovoitov <alexei.starovoitov@...il.com>
To:     Eric Dumazet <eric.dumazet@...il.com>
Cc:     Jeff Kirsher <jeffrey.t.kirsher@...el.com>,
        "David S. Miller" <davem@...emloft.net>,
        Network Development <netdev@...r.kernel.org>
Subject: Re: [RFC net-next PATCH] ipv6: New define for reoccurring code

On Fri, Jan 17, 2020 at 2:19 PM Eric Dumazet <eric.dumazet@...il.com> wrote:
>
>
>
> 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.

+1
I prefer sizeof() as well.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ