Thread (17 messages) 17 messages, 6 authors, 2024-06-28

Re: [PATCH] tty: mxser: Remove __counted_by from mxser_board.ports[]

From: Gustavo A. R. Silva <hidden>
Date: 2024-05-30 12:43:11
Also in: imx, linux-hardening, linux-patches, linux-serial, llvm, stable


On 30/05/24 09:40, Greg Kroah-Hartman wrote:
On Thu, May 30, 2024 at 08:22:03AM +0200, Jiri Slaby wrote:
quoted
quoted
  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.

The flexible array is nested four struct layers deep, see:

ports[].port.buf.sentinel.data[]

The error report could be more specific, though.

--
Gustavo
quoted
What does gcc say BTW?
quoted
Cc: stable@vger.kernel.org
Closes: https://github.com/ClangBuiltLinux/linux/issues/2026
Fixes: f34907ecca71 ("mxser: Annotate struct mxser_board with __counted_by")
I would not say "Fixes" here. It only works around a broken compiler.
Agreed, don't add Fixes: for this, it's a compiler bug, not a kernel
issue.

thanks,

greg k-h
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help