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: <20230315160828.00c9cedb@kernel.org>
Date:   Wed, 15 Mar 2023 16:08:28 -0700
From:   Jakub Kicinski <kuba@...nel.org>
To:     Eric Dumazet <edumazet@...gle.com>
Cc:     "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>,
        Linus Torvalds <torvalds@...ux-foundation.org>
Subject: Re: [PATCH net-next 1/8] inet: preserve const qualifier in
 inet_sk()

On Wed, 15 Mar 2023 15:37:50 -0700 Eric Dumazet wrote:
> I did see container_of_const() but the default: case was not appealing to me.
> 
> Maybe something like this?
> 
> diff --git a/include/linux/container_of.h b/include/linux/container_of.h
> index 713890c867bea78804defe1a015e3c362f40f85d..9a24d8db1f4c46166c07589bb084eda9b9ede8ba
> 100644
> --- a/include/linux/container_of.h
> +++ b/include/linux/container_of.h
> @@ -35,4 +35,10 @@
>                 default: ((type *)container_of(ptr, type, member))      \
>         )
> 
> +#define promote_to_type(ptr, oldtype, newtype)                 \
> +       _Generic(ptr,                                           \
> +                const oldtype *: ((const newtype *)(ptr)),     \
> +                oldtype *: ((newtype *)(ptr))                  \
> +       )

Perfect, I'll defer to you on whether you want to patch it on top 
or repost the series.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ