]> git.itanic.dy.fi Git - linux-stable/commit
scsi: bfa: Fix function pointer type mismatch for hcb_qe->cbfn
authorArnd Bergmann <arnd@arndb.de>
Thu, 22 Feb 2024 12:44:06 +0000 (13:44 +0100)
committerSasha Levin <sashal@kernel.org>
Tue, 26 Mar 2024 22:22:41 +0000 (18:22 -0400)
commit8413fc5ef952b5ddd606a42b2be1e15694e2f526
tree3c0a241d219a757ddc0481ad3a3f4bea00f36720
parent77d9c6364756ec8986b8d7f801bcb2295cfa036a
scsi: bfa: Fix function pointer type mismatch for hcb_qe->cbfn

[ Upstream commit b69600231f751304db914c63b937f7098ed2895c ]

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.

Fixes: 37ea0558b87a ("[SCSI] bfa: Added support to collect and reset fcport stats")
Fixes: 3ec4f2c8bff2 ("[SCSI] bfa: Added support to configure QOS and collect stats.")
Reviewed-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Link: https://lore.kernel.org/r/20240222124433.2046570-1-arnd@kernel.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/scsi/bfa/bfa.h
drivers/scsi/bfa/bfa_core.c
drivers/scsi/bfa/bfa_ioc.h
drivers/scsi/bfa/bfad_bsg.c