[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZN0VTpDBOSVHGayb@work>
Date: Wed, 16 Aug 2023 12:28:30 -0600
From: "Gustavo A. R. Silva" <gustavoars@...nel.org>
To: Anil Gurumurthy <anil.gurumurthy@...gic.com>,
Sudarsana Kalluru <sudarsana.kalluru@...gic.com>,
"James E.J. Bottomley" <jejb@...ux.ibm.com>,
"Martin K. Petersen" <martin.petersen@...cle.com>
Cc: linux-scsi@...r.kernel.org, linux-kernel@...r.kernel.org,
"Gustavo A. R. Silva" <gustavoars@...nel.org>,
linux-hardening@...r.kernel.org
Subject: [PATCH][next] 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.
Link: https://github.com/KSPP/linux/issues/339
Signed-off-by: Gustavo A. R. Silva <gustavoars@...nel.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
Powered by blists - more mailing lists