Skip to contentSkip to conversation

scsi: bfa: Replace one-element array with flexible-array member in struct fc_rscn_pl_s

PATCH Applied Gustavo A. R. Silva 3 participants 4 messages Aug 16, 2023 – Aug 25, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scsi: bfa: Replace one-element array with flexible-array member in struct fc_rscn_pl_s

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.

---
 drivers/scsi/bfa/bfa_fc.h      | 2 +-
 drivers/scsi/bfa/bfa_fcbuild.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/bfa/bfa_fc.h +1 -1
index a12d693065ce..1091aa428533 100644
@@ -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[];
 };
 
 /*
drivers/scsi/bfa/bfa_fcbuild.c +1 -1
index 773c84af784c..52303e8c716d 100644
@@ -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
Signature · 1 line
2.34.1
#2 lore raw
In reply to Gustavo A. R. Silva

Gustavo,

Quoted 4 lines

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!

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering
#3 lore raw
In reply to Gustavo A. R. Silva
Quoted 6 lines · Gustavo A. R. Silva

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
Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering