[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHk-=wj+6FLCdOMR+NH=JsL2VccNJGhg1_3OKw+YOaP0+PxmZg@mail.gmail.com>
Date: Wed, 15 Mar 2023 17:02:13 -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: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 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