Re: [PATCH 1/2] [v2] scsi: bfa: fix function pointer type mismatch for hcb_qe->cbfn

From: Martin K. Petersen
Date: Sun Mar 10 2024 - 19:05:48 EST


On Thu, 22 Feb 2024 13:44:06 +0100, Arnd Bergmann wrote:

> Some callback functions used here take a boolean argument, others
> take a status argument. This breaks KCFI type checking, so clang
> now warns about the function pointer cast:
>
> drivers/scsi/bfa/bfad_bsg.c:2138:29: error: cast from 'void (*)(void *, enum bfa_status)' to 'bfa_cb_cbfn_t' (aka 'void (*)(void *, enum bfa_boolean)') converts to incompatible function type [-Werror,-Wcast-function-type-strict]
>
> Assuming the code is actually correct here and the callers always match
> the argument types of the callee, rework this to replace the explicit
> cast with a union of the two pointer types. This does not change the
> behavior of the code, so if something is actually broken here, a larger
> rework may be necessary.
>
> [...]

Applied to 6.9/scsi-queue, thanks!

[1/2] scsi: bfa: fix function pointer type mismatch for hcb_qe->cbfn
https://git.kernel.org/mkp/scsi/c/b69600231f75
[2/2] scsi: bfa: fix function pointer type mismatch for state machines
https://git.kernel.org/mkp/scsi/c/37126399da15

--
Martin K. Petersen Oracle Linux Engineering