[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Y3gbwroyCqH2nSlz@nvidia.com>
Date: Fri, 18 Nov 2022 19:56:50 -0400
From: Jason Gunthorpe <jgg@...dia.com>
To: Kees Cook <keescook@...omium.org>
Cc: Dennis Dalessandro <dennis.dalessandro@...nelisnetworks.com>,
Leon Romanovsky <leon@...nel.org>, cgel.zte@...il.com,
"Gustavo A. R. Silva" <gustavoars@...nel.org>,
linux-rdma@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-hardening@...r.kernel.org
Subject: Re: [PATCH] IB/hfi1: Replace 1-element array with singleton
On Fri, Nov 18, 2022 at 01:58:51PM -0800, Kees Cook wrote:
> Zero-length arrays are deprecated[1] and are being replaced with
> flexible array members in support of the ongoing efforts to tighten the
> FORTIFY_SOURCE routines on memcpy(), correctly instrument array indexing
> with UBSAN_BOUNDS, and to globally enable -fstrict-flex-arrays=3.
>
> Replace zero-length array with flexible-array member "lvs" in struct
> opa_port_data_counters_msg and struct opa_port_error_counters64_msg.
>
> Additionally, the "port" member of several structs is defined as a
> single-element, but is only ever accessed at index 0. Replace it with a
> singleton so that flexible array usage is sane.
>
> This results in no differences in binary output.
>
> [1] https://github.com/KSPP/linux/issues/78
>
> Cc: Dennis Dalessandro <dennis.dalessandro@...nelisnetworks.com>
> Cc: Jason Gunthorpe <jgg@...pe.ca>
> Cc: Leon Romanovsky <leon@...nel.org>
> Cc: cgel.zte@...il.com
> Cc: "Gustavo A. R. Silva" <gustavoars@...nel.org>
> Cc: linux-rdma@...r.kernel.org
> Signed-off-by: Kees Cook <keescook@...omium.org>
> ---
> drivers/infiniband/hw/hfi1/mad.c | 22 +++++++++++-----------
> 1 file changed, 11 insertions(+), 11 deletions(-)
Applied to for-next, thanks
Jason
Powered by blists - more mailing lists