All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kees Cook <keescook@chromium.org>
To: Arnd Bergmann <arnd@kernel.org>
Cc: Anil Gurumurthy <anil.gurumurthy@qlogic.com>,
	Sudarsana Kalluru <sudarsana.kalluru@qlogic.com>,
	"James E.J. Bottomley" <jejb@linux.ibm.com>,
	"Martin K. Petersen" <martin.petersen@oracle.com>,
	Arnd Bergmann <arnd@arndb.de>,
	Azeem Shaikh <azeemshaikh38@gmail.com>,
	Bjorn Helgaas <bhelgaas@google.com>,
	linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] scsi: bfa: fix function pointer type mismatch for state machines
Date: Wed, 21 Jun 2023 11:33:18 -0700	[thread overview]
Message-ID: <202306211131.18885FF471@keescook> (raw)
In-Reply-To: <20230616092233.3229414-2-arnd@kernel.org>

On Fri, Jun 16, 2023 at 11:22:10AM +0200, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.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@arndb.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@chromium.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

  reply	other threads:[~2023-06-21 18:33 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-16  9:22 [PATCH 1/2] scsi: bfa: fix function pointer type mismatch for hcb_qe->cbfn Arnd Bergmann
2023-06-16  9:22 ` [PATCH 2/2] scsi: bfa: fix function pointer type mismatch for state machines Arnd Bergmann
2023-06-21 18:33   ` Kees Cook [this message]
2023-06-21 18:42     ` Arnd Bergmann
2023-06-21 18:33 ` [PATCH 1/2] scsi: bfa: fix function pointer type mismatch for hcb_qe->cbfn Kees Cook

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202306211131.18885FF471@keescook \
    --to=keescook@chromium.org \
    --cc=anil.gurumurthy@qlogic.com \
    --cc=arnd@arndb.de \
    --cc=arnd@kernel.org \
    --cc=azeemshaikh38@gmail.com \
    --cc=bhelgaas@google.com \
    --cc=jejb@linux.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=sudarsana.kalluru@qlogic.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.