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: <CAHk-=wiOf12nrYEF2vJMcucKjWPN-Ns_SW9fA7LwST_2Dzp7rw@mail.gmail.com>
Date:   Wed, 15 Mar 2023 16:54:05 -0700
From:   Linus Torvalds <torvalds@...ux-foundation.org>
To:     Eric Dumazet <edumazet@...gle.com>
Cc:     Jakub Kicinski <kuba@...nel.org>,
        "David S . Miller" <davem@...emloft.net>,
        Paolo Abeni <pabeni@...hat.com>,
        David Ahern <dsahern@...nel.org>, netdev@...r.kernel.org,
        eric.dumazet@...il.com,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Subject: Re: [PATCH net-next 1/8] inet: preserve const qualifier in inet_sk()

On Wed, Mar 15, 2023 at 4:46 PM Eric Dumazet <edumazet@...gle.com> wrote:
>
> Note that my v1 proposed this thing:
>
> #define inet_sk(sk) \
> +       _Generic(sk,                                           \
> +                const struct sock * : ((const struct inet_sock *)(sk)), \
> +                struct sock * : ((struct inet_sock *)(sk)) \
> +       )

Right. That was better.

But:

> Jakub feedback was to instead use a common helper, and CCed you on the
> discussion.
> I do not see yet how to do this 'without cast'

That's _exactly_ what container_of_const() does.

I actually would want to make "container_of()" itself do that
correctly, but we clearly have too many broken cases as-is, so
'container_of_const' it is.

             Linus

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ