[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250507202230.GA3536142@ax162>
Date: Wed, 7 May 2025 21:22:30 +0100
From: Nathan Chancellor <nathan@...nel.org>
To: Kees Cook <kees@...nel.org>
Cc: Saurav Kashyap <skashyap@...vell.com>, Javed Hasan <jhasan@...vell.com>,
GR-QLogic-Storage-Upstream@...vell.com,
"James E.J. Bottomley" <James.Bottomley@...senpartnership.com>,
"Martin K. Petersen" <martin.petersen@...cle.com>,
linux-scsi@...r.kernel.org, WangYuli <wangyuli@...ontech.com>,
Mark Brown <broonie@...nel.org>,
"Dr. David Alan Gilbert" <linux@...blig.org>,
linux-kernel@...r.kernel.org, linux-hardening@...r.kernel.org
Subject: Re: [PATCH] scsi: qedf: Use designated initializer for struct
qed_fcoe_cb_ops
On Fri, May 02, 2025 at 03:41:57PM -0700, Kees Cook wrote:
> 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
Cc: stable@...r.kernel.org
Fixes: 035f7f87b729 ("randstruct: Enable Clang support")
> Signed-off-by: Kees Cook <kees@...nel.org>
> ---
> Cc: Saurav Kashyap <skashyap@...vell.com>
> Cc: Javed Hasan <jhasan@...vell.com>
> Cc: <GR-QLogic-Storage-Upstream@...vell.com>
> Cc: "James E.J. Bottomley" <James.Bottomley@...senPartnership.com>
> Cc: "Martin K. Petersen" <martin.petersen@...cle.com>
> Cc: <linux-scsi@...r.kernel.org>
> ---
> drivers/scsi/qedf/qedf_main.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/scsi/qedf/qedf_main.c b/drivers/scsi/qedf/qedf_main.c
> index 436bd29d5eba..6b1ebab36fa3 100644
> --- a/drivers/scsi/qedf/qedf_main.c
> +++ b/drivers/scsi/qedf/qedf_main.c
> @@ -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,
> --
> 2.34.1
>
Powered by blists - more mailing lists