linux/drivers/scsi/bfa
Arnd Bergmann 322eb43c0e scsi: bfa: Fix function pointer type mismatch for hcb_qe->cbfn
[ Upstream commit b69600231f ]

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: 37ea0558b8 ("[SCSI] bfa: Added support to collect and reset fcport stats")
Fixes: 3ec4f2c8bf ("[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>
History 2024-03-26 18:20:55 -04:00
..
bfa.h scsi: bfa: Fix function pointer type mismatch for hcb_qe->cbfn 2024-03-26 18:20:55 -04:00
bfa_core.c scsi: bfa: Fix function pointer type mismatch for hcb_qe->cbfn 2024-03-26 18:20:55 -04:00
bfa_cs.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 292 2019-06-05 17:36:38 +02:00
bfa_defs.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 292 2019-06-05 17:36:38 +02:00
bfa_defs_fcs.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 292 2019-06-05 17:36:38 +02:00
bfa_defs_svc.h scsi: bfa: Fix typo 2021-05-21 17:00:21 -04:00
bfa_fc.h scsi: bfa: Fix a typo in two places 2021-03-24 23:06:27 -04:00
bfa_fcbuild.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 292 2019-06-05 17:36:38 +02:00
bfa_fcbuild.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 292 2019-06-05 17:36:38 +02:00
bfa_fcpim.c scsi: bfa: Drop driver-defined SCSI status codes 2021-01-22 21:14:08 -05:00
bfa_fcpim.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 292 2019-06-05 17:36:38 +02:00
bfa_fcs.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 292 2019-06-05 17:36:38 +02:00
bfa_fcs.h scsi: bfa: Remove unnecessary struct declarations 2021-04-05 23:44:01 -04:00
bfa_fcs_fcpim.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 292 2019-06-05 17:36:38 +02:00
bfa_fcs_lport.c scsi: bfa: Move a large struct from the stack onto the heap 2021-03-15 22:28:58 -04:00
bfa_fcs_rport.c treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
bfa_hw_cb.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 292 2019-06-05 17:36:38 +02:00
bfa_hw_ct.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 292 2019-06-05 17:36:38 +02:00
bfa_ioc.c scsi: bfa: Fix fall-through warnings for Clang 2020-12-02 12:59:46 -05:00
bfa_ioc.h scsi: bfa: Fix function pointer type mismatch for hcb_qe->cbfn 2024-03-26 18:20:55 -04:00
bfa_ioc_cb.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 292 2019-06-05 17:36:38 +02:00
bfa_ioc_ct.c scsi: bfa: Demote non-compliant kerneldoc headers to standard comments 2020-07-24 22:32:07 -04:00
bfa_modules.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 292 2019-06-05 17:36:38 +02:00
bfa_plog.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 292 2019-06-05 17:36:38 +02:00
bfa_port.c scsi: bfa: Staticify local functions 2020-07-24 22:31:56 -04:00
bfa_port.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 292 2019-06-05 17:36:38 +02:00
bfa_svc.c scsi: bfa: Fix inconsistent indenting 2021-05-21 17:01:18 -04:00
bfa_svc.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 292 2019-06-05 17:36:38 +02:00
bfad.c scsi: bfa: Remove useless DMA-32 fallback configuration 2022-01-24 23:30:29 -05:00
bfad_attr.c scsi: bfa: Replace snprintf() with sysfs_emit() 2022-01-31 16:59:59 -05:00
bfad_bsg.c scsi: bfa: Fix function pointer type mismatch for hcb_qe->cbfn 2024-03-26 18:20:55 -04:00
bfad_bsg.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 292 2019-06-05 17:36:38 +02:00
bfad_debugfs.c scsi: bfa: Remove redundant NULL check 2022-04-25 23:23:05 -04:00
bfad_drv.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 292 2019-06-05 17:36:38 +02:00
bfad_im.c scsi: bfa: Remove unneeded flush_workqueue() 2022-04-25 23:38:38 -04:00
bfad_im.h scsi: bfa: Stop using the SCSI pointer 2022-02-22 21:11:04 -05:00
bfi.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 292 2019-06-05 17:36:38 +02:00
bfi_ms.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 292 2019-06-05 17:36:38 +02:00
bfi_reg.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 292 2019-06-05 17:36:38 +02:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00