Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1627853 > unrolled thread
| Started by | Kees Cook <keescook@chromium.org> |
|---|---|
| First post | 2017-04-21 00:10 +0200 |
| Last post | 2017-04-21 16:20 +0200 |
| Articles | 3 — 3 participants |
Back to article view | Back to linux.kernel
[PATCH v3] scsi/bfa: use designated initializers Kees Cook <keescook@chromium.org> - 2017-04-21 00:10 +0200
Re: [PATCH v3] scsi/bfa: use designated initializers Christoph Hellwig <hch@lst.de> - 2017-04-21 07:40 +0200
Re: [PATCH v3] scsi/bfa: use designated initializers "Martin K. Petersen" <martin.petersen@oracle.com> - 2017-04-21 16:20 +0200
| From | Kees Cook <keescook@chromium.org> |
|---|---|
| Date | 2017-04-21 00:10 +0200 |
| Subject | [PATCH v3] scsi/bfa: use designated initializers |
| Message-ID | <tysqZ-68E-15@gated-at.bofh.it> |
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>
---
v3:
- drop bfa_module_s changes, since that has been removed entirely; hch.
- init array with enum literals; hch.
---
drivers/scsi/bfa/bfa_fcs_lport.c | 31 +++++++++++++++++++++----------
1 file 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
--
2.7.4
--
Kees Cook
Pixel Security
[toc] | [next] | [standalone]
| From | Christoph Hellwig <hch@lst.de> |
|---|---|
| Date | 2017-04-21 07:40 +0200 |
| Message-ID | <tyzst-1Wa-5@gated-at.bofh.it> |
| In reply to | #1627853 |
Looks good, Reviewed-by: Christoph Hellwig <hch@lst.de>
[toc] | [prev] | [next] | [standalone]
| From | "Martin K. Petersen" <martin.petersen@oracle.com> |
|---|---|
| Date | 2017-04-21 16:20 +0200 |
| Message-ID | <tyHzI-6Pl-9@gated-at.bofh.it> |
| In reply to | #1627853 |
Kees Cook <keescook@chromium.org> writes: Kees, > 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. Applied to 4.12/scsi-queue. Thanks! -- Martin K. Petersen Oracle Linux Engineering
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web