[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANn89iKzNh0hvJNbKvo5tokg-Kf-btNYpMik8KQ53vLAWgrY9Q@mail.gmail.com>
Date: Wed, 15 Mar 2023 17:11:06 -0700
From: Eric Dumazet <edumazet@...gle.com>
To: Linus Torvalds <torvalds@...ux-foundation.org>
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 5:02 PM Linus Torvalds
<torvalds@...ux-foundation.org> wrote:
>
> On Wed, Mar 15, 2023 at 4:56 PM Eric Dumazet <edumazet@...gle.com> wrote:
> >
> > container_of_const() does not detect this bug at compile time, does it ?
> >
> > struct sk_buff *skb = ...;
> >
> > struct inet_sk *inet = inet_sk(skb);
>
> You didn't actually test it, did you?
I thought I did, sorry. I will spend more time on it.
>
> I get about 40 lines of error messages about how broken that is, starting with
>
> ./include/linux/build_bug.h:78:41: error: static assertion failed:
> "pointer type mismatch in container_of()"
>
> exactly because yes, 'container_of()' is very pissy indeed about bogus
> conversions.
>
> You can only convert a named member into a containing structure, and
> 'inet_sk' does not contain a member named 'sk' that is of type 'struct
> skb_buff'.
>
> Linus
Powered by blists - more mailing lists