summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKees Cook <keescook@chromium.org>2017-04-20 15:00:02 -0700
committerMartin K. Petersen <martin.petersen@oracle.com>2017-04-21 10:11:34 -0400
commitb34b10a725e22980a331c796577e368ebb5ed895 (patch)
tree39ff719394803313b6c44e827a27092ad0542972
parent7ecaeaffd72ada135016564c08f5aa0b0be338f7 (diff)
scsi: bfa: use designated initializers
Prepare to mark sensitive kernel structures for randomization by making sure they're using designated initializers. This also initializes the array members using the enum used to look up __port_action entries. Signed-off-by: Kees Cook <keescook@chromium.org> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
-rw-r--r--drivers/scsi/bfa/bfa_fcs_lport.c31
1 files changed, 21 insertions, 10 deletions
diff --git a/drivers/scsi/bfa/bfa_fcs_lport.c b/drivers/scsi/bfa/bfa_fcs_lport.c
index 4ddda72f60e6..638c0a2857f7 100644
--- a/drivers/scsi/bfa/bfa_fcs_lport.c
+++ b/drivers/scsi/bfa/bfa_fcs_lport.c
@@ -89,16 +89,27 @@ static struct {
void (*online) (struct bfa_fcs_lport_s *port);
void (*offline) (struct bfa_fcs_lport_s *port);
} __port_action[] = {
- {
- bfa_fcs_lport_unknown_init, bfa_fcs_lport_unknown_online,
- bfa_fcs_lport_unknown_offline}, {
- bfa_fcs_lport_fab_init, bfa_fcs_lport_fab_online,
- bfa_fcs_lport_fab_offline}, {
- bfa_fcs_lport_n2n_init, bfa_fcs_lport_n2n_online,
- bfa_fcs_lport_n2n_offline}, {
- bfa_fcs_lport_loop_init, bfa_fcs_lport_loop_online,
- bfa_fcs_lport_loop_offline},
- };
+ [BFA_FCS_FABRIC_UNKNOWN] = {
+ .init = bfa_fcs_lport_unknown_init,
+ .online = bfa_fcs_lport_unknown_online,
+ .offline = bfa_fcs_lport_unknown_offline
+ },
+ [BFA_FCS_FABRIC_SWITCHED] = {
+ .init = bfa_fcs_lport_fab_init,
+ .online = bfa_fcs_lport_fab_online,
+ .offline = bfa_fcs_lport_fab_offline
+ },
+ [BFA_FCS_FABRIC_N2N] = {
+ .init = bfa_fcs_lport_n2n_init,
+ .online = bfa_fcs_lport_n2n_online,
+ .offline = bfa_fcs_lport_n2n_offline
+ },
+ [BFA_FCS_FABRIC_LOOP] = {
+ .init = bfa_fcs_lport_loop_init,
+ .online = bfa_fcs_lport_loop_online,
+ .offline = bfa_fcs_lport_loop_offline
+ },
+};
/*
* fcs_port_sm FCS logical port state machine