scsi: qedf: Use designated initializer for struct qed_fcoe_cb_ops
Subsystems (2)
PATCH 1/1 scsi: qedf: Use designated initializer for struct qed_fcoe_cb_ops
Recent fixes to the randstruct GCC plugin allowed it to notice that this structure is entirely function pointers and is therefore subject to randomization, but doing so requires that it always use designated initializers. Explicitly specify the "common" member as being initialized. Silences:
drivers/scsi/qedf/qedf_main.c:702:9: error: positional initialization of field in 'struct' declared with 'designated_init' attribute [-Werror=designated-init]
702 | {
| ^---
Cc: Saurav Kashyap <[email protected]>
Cc: Javed Hasan <[email protected]>
Cc: <[email protected]>
Cc: "James E.J. Bottomley" <[email protected]>
Cc: "Martin K. Petersen" <[email protected]>
Cc: <[email protected]>
--- drivers/scsi/qedf/qedf_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/qedf/qedf_main.c +1 -1
@@ -699,7 +699,7 @@ static u32 qedf_get_login_failures(void *cookie) }static struct qed_fcoe_cb_ops qedf_cb_ops = { - { + .common = { .link_update = qedf_link_update, .bw_update = qedf_bw_update, .schedule_recovery_handler = qedf_schedule_recovery_handler,
Signature · 1 line
2.34.1
Martin K. Petersen
AppliedKees,
Quoted 5 lines
Recent fixes to the randstruct GCC plugin allowed it to notice that this structure is entirely function pointers and is therefore subject to randomization, but doing so requires that it always use designated initializers. Explicitly specify the "common" member as being initialized.
Applied to 6.16/scsi-staging, thanks!
Signature · 1 line
Martin K. Petersen
Quoted 11 lines · Kees Cook
Recent fixes to the randstruct GCC plugin allowed it to notice that this structure is entirely function pointers and is therefore subject to randomization, but doing so requires that it always use designated initializers. Explicitly specify the "common" member as being initialized. Silences:
drivers/scsi/qedf/qedf_main.c:702:9: error: positional initialization of field in 'struct' declared with 'designated_init' attribute [-Werror=designated-init]702 | { | ^Fixes c2ea09b193d2 ("randstruct: gcc-plugin: Remove bogus void member")
For the record, this is also needed after your recent change to clang to do the same thing as the plugin:
drivers/scsi/qedf/qedf_main.c:702:2: error: a randomized struct can only be initialized with a designated initializer
702 | {
| ^so this should probably have
Quoted 28 lines
Signed-off-by Kees Cook <[email protected]>---
Cc: Saurav Kashyap <[email protected]>
Cc: Javed Hasan <[email protected]>
Cc: <[email protected]>
Cc: "James E.J. Bottomley" <[email protected]>
Cc: "Martin K. Petersen" <[email protected]>
Cc: <[email protected]>--- drivers/scsi/qedf/qedf_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/scsi/qedf/qedf_main.c +1
-1@@ -699,7 +699,7 @@ static u32 qedf_get_login_failures(void *cookie) }static struct qed_fcoe_cb_ops qedf_cb_ops = { - { + .common = { .link_update = qedf_link_update, .bw_update = qedf_bw_update, .schedule_recovery_handler = qedf_schedule_recovery_handler,Signature · 1 line
2.34.1