public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH][next] scsi: bfa: Replace one-element array with flexible-array member in struct fc_rscn_pl_s
@ 2023-08-16 18:28 Gustavo A. R. Silva
  2023-08-16 20:39 ` Kees Cook
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Gustavo A. R. Silva @ 2023-08-16 18:28 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 and zero-length arrays are deprecated. So, replace
one-element array in struct fc_rscn_pl_s with flexible-array member.

This results in no differences in binary output.

Link: https://github.com/KSPP/linux/issues/339
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
---
 drivers/scsi/bfa/bfa_fc.h      | 2 +-
 drivers/scsi/bfa/bfa_fcbuild.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/bfa/bfa_fc.h b/drivers/scsi/bfa/bfa_fc.h
index a12d693065ce..1091aa428533 100644
--- a/drivers/scsi/bfa/bfa_fc.h
+++ b/drivers/scsi/bfa/bfa_fc.h
@@ -800,7 +800,7 @@ struct fc_rscn_pl_s {
 	u8	command;
 	u8	pagelen;
 	__be16	payldlen;
-	struct fc_rscn_event_s event[1];
+	struct fc_rscn_event_s event[];
 };
 
 /*
diff --git a/drivers/scsi/bfa/bfa_fcbuild.c b/drivers/scsi/bfa/bfa_fcbuild.c
index 773c84af784c..52303e8c716d 100644
--- a/drivers/scsi/bfa/bfa_fcbuild.c
+++ b/drivers/scsi/bfa/bfa_fcbuild.c
@@ -1051,7 +1051,7 @@ fc_rscn_build(struct fchs_s *fchs, struct fc_rscn_pl_s *rscn,
 	rscn->event[0].format = FC_RSCN_FORMAT_PORTID;
 	rscn->event[0].portid = s_id;
 
-	return sizeof(struct fc_rscn_pl_s);
+	return struct_size(rscn, event, 1);
 }
 
 u16
-- 
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 in struct fc_rscn_pl_s
  2023-08-16 18:28 [PATCH][next] scsi: bfa: Replace one-element array with flexible-array member in struct fc_rscn_pl_s Gustavo A. R. Silva
@ 2023-08-16 20:39 ` Kees Cook
  2023-08-21 20:53 ` Martin K. Petersen
  2023-08-25  1:12 ` Martin K. Petersen
  2 siblings, 0 replies; 4+ messages in thread
From: Kees Cook @ 2023-08-16 20:39 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 Wed, Aug 16, 2023 at 12:28:30PM -0600, Gustavo A. R. Silva wrote:
> One-element and zero-length arrays are deprecated. So, replace
> one-element array in struct fc_rscn_pl_s with flexible-array member.
> 
> This results in no differences in binary output.
> 
> Link: https://github.com/KSPP/linux/issues/339
> 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 in struct fc_rscn_pl_s
  2023-08-16 18:28 [PATCH][next] scsi: bfa: Replace one-element array with flexible-array member in struct fc_rscn_pl_s Gustavo A. R. Silva
  2023-08-16 20:39 ` Kees Cook
@ 2023-08-21 20:53 ` Martin K. Petersen
  2023-08-25  1:12 ` Martin K. Petersen
  2 siblings, 0 replies; 4+ messages in thread
From: Martin K. Petersen @ 2023-08-21 20:53 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 and zero-length arrays are deprecated. So, replace
> one-element array in struct fc_rscn_pl_s with flexible-array member.
>
> This results in no differences in binary output.

Applied to 6.6/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 in struct fc_rscn_pl_s
  2023-08-16 18:28 [PATCH][next] scsi: bfa: Replace one-element array with flexible-array member in struct fc_rscn_pl_s Gustavo A. R. Silva
  2023-08-16 20:39 ` Kees Cook
  2023-08-21 20:53 ` Martin K. Petersen
@ 2023-08-25  1:12 ` Martin K. Petersen
  2 siblings, 0 replies; 4+ messages in thread
From: Martin K. Petersen @ 2023-08-25  1:12 UTC (permalink / raw)
  To: Anil Gurumurthy, Sudarsana Kalluru, James E.J. Bottomley,
	Gustavo A. R. Silva
  Cc: Martin K . Petersen, linux-scsi, linux-kernel, linux-hardening

On Wed, 16 Aug 2023 12:28:30 -0600, Gustavo A. R. Silva wrote:

> One-element and zero-length arrays are deprecated. So, replace
> one-element array in struct fc_rscn_pl_s with flexible-array member.
> 
> This results in no differences in binary output.
> 
> 

Applied to 6.6/scsi-queue, thanks!

[1/1] scsi: bfa: Replace one-element array with flexible-array member in struct fc_rscn_pl_s
      https://git.kernel.org/mkp/scsi/c/56a4d69a26c9

-- 
Martin K. Petersen	Oracle Linux Engineering

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

end of thread, other threads:[~2023-08-25  1:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-16 18:28 [PATCH][next] scsi: bfa: Replace one-element array with flexible-array member in struct fc_rscn_pl_s Gustavo A. R. Silva
2023-08-16 20:39 ` Kees Cook
2023-08-21 20:53 ` Martin K. Petersen
2023-08-25  1:12 ` 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