linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH][next] scsi: bfa: Replace one-element array with flexible-array member
@ 2022-11-15 20:25 Gustavo A. R. Silva
  2022-11-16 22:24 ` Kees Cook
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Gustavo A. R. Silva @ 2022-11-15 20:25 UTC (permalink / raw)
  To: Anil Gurumurthy, Sudarsana Kalluru, James E.J. Bottomley,
	Martin K. Petersen
  Cc: linux-scsi, linux-kernel, Gustavo A. R. Silva, linux-hardening

One-element arrays are deprecated, and we are replacing them with flexible
array members instead. So, replace one-element array with flexible-array
member in struct fdmi_attr_s.

Important to mention is that doing a build before/after this patch results
in no binary output differences.

This helps with the ongoing efforts to tighten the FORTIFY_SOURCE routines
on memcpy() and help us make progress towards globally enabling
-fstrict-flex-arrays=3 [1].

Link: https://github.com/KSPP/linux/issues/209
Link: https://github.com/KSPP/linux/issues/79
Link: https://gcc.gnu.org/pipermail/gcc-patches/2022-October/602902.html [1]
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
---
 drivers/scsi/bfa/bfa_fc.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/bfa/bfa_fc.h b/drivers/scsi/bfa/bfa_fc.h
index 0314e4b9e1fb..a12d693065ce 100644
--- a/drivers/scsi/bfa/bfa_fc.h
+++ b/drivers/scsi/bfa/bfa_fc.h
@@ -1548,7 +1548,7 @@ enum fdmi_port_attribute_type {
 struct fdmi_attr_s {
 	__be16        type;
 	__be16        len;
-	u8         value[1];
+	u8         value[];
 };
 
 /*
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH][next] scsi: bfa: Replace one-element array with flexible-array member
  2022-11-15 20:25 [PATCH][next] scsi: bfa: Replace one-element array with flexible-array member Gustavo A. R. Silva
@ 2022-11-16 22:24 ` Kees Cook
  2022-11-17 18:16 ` Martin K. Petersen
  2022-11-26  3:27 ` Martin K. Petersen
  2 siblings, 0 replies; 4+ messages in thread
From: Kees Cook @ 2022-11-16 22:24 UTC (permalink / raw)
  To: Gustavo A. R. Silva
  Cc: Anil Gurumurthy, Sudarsana Kalluru, James E.J. Bottomley,
	Martin K. Petersen, linux-scsi, linux-kernel, linux-hardening

On Tue, Nov 15, 2022 at 02:25:16PM -0600, Gustavo A. R. Silva wrote:
> One-element arrays are deprecated, and we are replacing them with flexible
> array members instead. So, replace one-element array with flexible-array
> member in struct fdmi_attr_s.
> 
> Important to mention is that doing a build before/after this patch results
> in no binary output differences.
> 
> This helps with the ongoing efforts to tighten the FORTIFY_SOURCE routines
> on memcpy() and help us make progress towards globally enabling
> -fstrict-flex-arrays=3 [1].
> 
> Link: https://github.com/KSPP/linux/issues/209
> Link: https://github.com/KSPP/linux/issues/79
> Link: https://gcc.gnu.org/pipermail/gcc-patches/2022-October/602902.html [1]
> Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>

Reviewed-by: Kees Cook <keescook@chromium.org>

-- 
Kees Cook

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH][next] scsi: bfa: Replace one-element array with flexible-array member
  2022-11-15 20:25 [PATCH][next] scsi: bfa: Replace one-element array with flexible-array member Gustavo A. R. Silva
  2022-11-16 22:24 ` Kees Cook
@ 2022-11-17 18:16 ` Martin K. Petersen
  2022-11-26  3:27 ` Martin K. Petersen
  2 siblings, 0 replies; 4+ messages in thread
From: Martin K. Petersen @ 2022-11-17 18:16 UTC (permalink / raw)
  To: Gustavo A. R. Silva
  Cc: Anil Gurumurthy, Sudarsana Kalluru, James E.J. Bottomley,
	Martin K. Petersen, linux-scsi, linux-kernel, linux-hardening


Gustavo,

> One-element arrays are deprecated, and we are replacing them with flexible
> array members instead. So, replace one-element array with flexible-array
> member in struct fdmi_attr_s.

Applied to 6.2/scsi-staging, thanks!

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH][next] scsi: bfa: Replace one-element array with flexible-array member
  2022-11-15 20:25 [PATCH][next] scsi: bfa: Replace one-element array with flexible-array member Gustavo A. R. Silva
  2022-11-16 22:24 ` Kees Cook
  2022-11-17 18:16 ` Martin K. Petersen
@ 2022-11-26  3:27 ` Martin K. Petersen
  2 siblings, 0 replies; 4+ messages in thread
From: Martin K. Petersen @ 2022-11-26  3:27 UTC (permalink / raw)
  To: Sudarsana Kalluru, Anil Gurumurthy, Gustavo A. R. Silva,
	James E.J. Bottomley
  Cc: Martin K . Petersen, linux-hardening, linux-kernel, linux-scsi

On Tue, 15 Nov 2022 14:25:16 -0600, Gustavo A. R. Silva wrote:

> One-element arrays are deprecated, and we are replacing them with flexible
> array members instead. So, replace one-element array with flexible-array
> member in struct fdmi_attr_s.
> 
> Important to mention is that doing a build before/after this patch results
> in no binary output differences.
> 
> [...]

Applied to 6.2/scsi-queue, thanks!

[1/1] scsi: bfa: Replace one-element array with flexible-array member
      https://git.kernel.org/mkp/scsi/c/c4c5fa35563a

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-11-26  3:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-15 20:25 [PATCH][next] scsi: bfa: Replace one-element array with flexible-array member Gustavo A. R. Silva
2022-11-16 22:24 ` Kees Cook
2022-11-17 18:16 ` Martin K. Petersen
2022-11-26  3:27 ` Martin K. Petersen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).