[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAGG=3QU6kREyhAoRC+68UFX4txAKK-qK-HNvgzeqphj5-1te_g@mail.gmail.com>
Date: Thu, 30 May 2024 01:43:03 -0700
From: Bill Wendling <morbo@...gle.com>
To: Jiri Slaby <jirislaby@...nel.org>
Cc: "Gustavo A. R. Silva" <gustavo@...eddedor.com>, Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Nathan Chancellor <nathan@...nel.org>, Kees Cook <keescook@...omium.org>,
"Gustavo A. R. Silva" <gustavoars@...nel.org>, Justin Stitt <justinstitt@...gle.com>,
linux-serial@...r.kernel.org, imx@...ts.linux.dev,
linux-arm-kernel@...ts.infradead.org, linux-hardening@...r.kernel.org,
llvm@...ts.linux.dev, patches@...ts.linux.dev, stable@...r.kernel.org
Subject: Re: [PATCH] tty: mxser: Remove __counted_by from mxser_board.ports[]
On Thu, May 30, 2024 at 1:41 AM Jiri Slaby <jirislaby@...nel.org> wrote:
>
> On 30. 05. 24, 10:33, Jiri Slaby wrote:
> > On 30. 05. 24, 10:12, Gustavo A. R. Silva wrote:
> >>
> >>
> >> On 30/05/24 09:40, Greg Kroah-Hartman wrote:
> >>> On Thu, May 30, 2024 at 08:22:03AM +0200, Jiri Slaby wrote:
> >>>>> This will be an error in a future compiler version
> >>>>> [-Werror,-Wbounds-safety-counted-by-elt-type-unknown-size]
> >>>>> 291 | struct mxser_port ports[] __counted_by(nports);
> >>>>> | ^~~~~~~~~~~~~~~~~~~~~~~~~
> >>>>> 1 error generated.
> >>>>>
> >>>>> Remove this use of __counted_by to fix the warning/error. However,
> >>>>> rather than remove it altogether, leave it commented, as it may be
> >>>>> possible to support this in future compiler releases.
> >>>>
> >>>> This looks like a compiler bug/deficiency.
> >>>
> >>> I agree, why not just turn that option off in the compiler so that these
> >>> "warnings" will not show up?
> >>
> >> It's not a compiler bug.
> >
> > It is, provided the code compiles and runs.
> >
> >> The flexible array is nested four struct layers deep, see:
> >>
> >> ports[].port.buf.sentinel.data[]
> >>
> >> The error report could be more specific, though.
> >
> > Ah, ok. The assumption is sentinel.data[] shall be unused. That's why it
> > all works. The size is well known, [] is zero size, right?
> >
> > Still, fix the compiler, not the code.
>
> Or fix the code (properly).
>
> Flex arrays (even empty) in the middle of structs (like
> ports[].port.buf.sentinel.data[] above is) are deprecated since gcc 14:
> https://gcc.gnu.org/pipermail/gcc-patches/2023-August/626516.html
>
> So we should get rid of all those. Sooner than later.
>
Yes! Please do this.
-bw
Powered by blists - more mailing lists