[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <202306211131.18885FF471@keescook>
Date: Wed, 21 Jun 2023 11:33:18 -0700
From: Kees Cook <keescook@...omium.org>
To: Arnd Bergmann <arnd@...nel.org>
Cc: 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>,
Arnd Bergmann <arnd@...db.de>,
Azeem Shaikh <azeemshaikh38@...il.com>,
Bjorn Helgaas <bhelgaas@...gle.com>,
linux-scsi@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/2] scsi: bfa: fix function pointer type mismatch for
state machines
On Fri, Jun 16, 2023 at 11:22:10AM +0200, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@...db.de>
>
> The bfa driver is full of state machines and a generic abstraction layer
> for them. This relies on casting function pointers, but that is no longer
> allowed when CONFIG_CFI_CLANG is enabled and causes a huge number of
> warnings like:
>
> drivers/scsi/bfa/bfad.c:169:3: error: cast from 'void (*)(struct bfad_s *, enum bfad_sm_event)' to 'bfa_sm_t' (aka 'void (*)(void *, int)') converts to incompatible function type [-Werror,-Wcast-function-type-strict]
> bfa_sm_set_state(bfad, bfad_sm_created);
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> Rework the mechanism to no longer require the function pointer casts,
> by having separate types for each individual state machine. This in
> turn requires moving the enum definitions for each state machine
> into the header files in order to define the typedef.
>
> Signed-off-by: Arnd Bergmann <arnd@...db.de>
Thanks for all this! It's a lot of mechanical changes, but looks correct
to me. One nit below...
Reviewed-by: Kees Cook <keescook@...omium.org>
> [...]
> static void
> -bfad_sm_uninit(struct bfad_s *bfad, enum bfad_sm_event event);
> +bfad_sm_uninit(struct bfad_s *bfad, enum bfad_sm_event);
> static void
> -bfad_sm_created(struct bfad_s *bfad, enum bfad_sm_event event);
> +bfad_sm_created(struct bfad_s *bfad, enum bfad_sm_event);
> static void
> -bfad_sm_initializing(struct bfad_s *bfad, enum bfad_sm_event event);
> +bfad_sm_initializing(struct bfad_s *bfad, enum bfad_sm_event);
> static void
> -bfad_sm_operational(struct bfad_s *bfad, enum bfad_sm_event event);
> +bfad_sm_operational(struct bfad_s *bfad, enum bfad_sm_event);
> static void
> -bfad_sm_stopping(struct bfad_s *bfad, enum bfad_sm_event event);
> +bfad_sm_stopping(struct bfad_s *bfad, enum bfad_sm_event);
> static void
> -bfad_sm_failed(struct bfad_s *bfad, enum bfad_sm_event event);
> +bfad_sm_failed(struct bfad_s *bfad, enum bfad_sm_event);
> static void
> -bfad_sm_fcs_exit(struct bfad_s *bfad, enum bfad_sm_event event);
> +bfad_sm_fcs_exit(struct bfad_s *bfad, enum bfad_sm_event);
This bit doesn't seem needed? i.e. why remove the prototype's argument
names?
--
Kees Cook
Powered by blists - more mailing lists