linux/drivers/scsi/csiostor
Arnd Bergmann 9f3dbcb563 scsi: csiostor: Avoid function pointer casts
csiostor uses function pointer casts to keep the csio_ln_ev state machine
hidden, but this causes warnings about control flow integrity (KCFI)
violations in clang-16 and higher:

drivers/scsi/csiostor/csio_lnode.c:1098:33: error: cast from 'void (*)(struct csio_lnode *, enum csio_ln_ev)' to 'csio_sm_state_t' (aka 'void (*)(void *, unsigned int)') converts to incompatible function type [-Werror,-Wcast-function-type-strict]
 1098 |         return (csio_get_state(ln) == ((csio_sm_state_t)csio_lns_ready));
      |                                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/scsi/csiostor/csio_lnode.c:1369:29: error: cast from 'void (*)(struct csio_lnode *, enum csio_ln_ev)' to 'csio_sm_state_t' (aka 'void (*)(void *, unsigned int)') converts to incompatible function type [-Werror,-Wcast-function-type-strict]
 1369 |         if (csio_get_state(ln) == ((csio_sm_state_t)csio_lns_uninit)) {
      |                                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/scsi/csiostor/csio_lnode.c:1373:29: error: cast from 'void (*)(struct csio_lnode *, enum csio_ln_ev)' to 'csio_sm_state_t' (aka 'void (*)(void *, unsigned int)') converts to incompatible function type [-Werror,-Wcast-function-type-strict]
 1373 |         if (csio_get_state(ln) == ((csio_sm_state_t)csio_lns_ready)) {
      |                                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/scsi/csiostor/csio_lnode.c:1377:29: error: cast from 'void (*)(struct csio_lnode *, enum csio_ln_ev)' to 'csio_sm_state_t' (aka 'void (*)(void *, unsigned int)') converts to incompatible function type [-Werror,-Wcast-function-type-strict]
 1377 |         if (csio_get_state(ln) == ((csio_sm_state_t)csio_lns_offline)) {
      |                                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Move the enum into a shared header so the correct types can be used without
the need for casts.

Fixes: a3667aaed5 ("[SCSI] csiostor: Chelsio FCoE offload driver")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Link: https://lore.kernel.org/r/20240213100518.457623-1-arnd@kernel.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2024-02-15 15:14:01 -05:00
..
csio_attr.c
csio_defs.h scsi: csiostor: Avoid function pointer casts 2024-02-15 15:14:01 -05:00
csio_hw_chip.h
csio_hw_t5.c scsi: csiostor: Fix a typo 2021-03-24 22:54:24 -04:00
csio_hw.c SCSI misc on 20201013 2020-10-14 15:15:35 -07:00
csio_hw.h
csio_init.c scsi: csiostor: Replace deprecated strncpy() with strscpy() 2023-11-15 09:05:46 -05:00
csio_init.h
csio_isr.c
csio_lnode.c scsi: csiostor: Avoid function pointer casts 2024-02-15 15:14:01 -05:00
csio_lnode.h scsi: csiostor: Avoid function pointer casts 2024-02-15 15:14:01 -05:00
csio_mb.c scsi: csiostor: clean up indentation issue 2019-09-30 23:09:07 -04:00
csio_mb.h
csio_rnode.c scsi: csiostor: Add missing description for csio_rnode_fwevt_handler()'s 'fwevt' param 2020-07-24 22:32:07 -04:00
csio_rnode.h
csio_scsi.c scsi: csiostor: Convert sysfs snprintf() to sysfs_emit() 2022-09-15 22:35:21 -04:00
csio_scsi.h scsi: csio: Stop using the SCSI pointer 2022-02-22 21:11:04 -05:00
csio_wr.c scsi: csiostor: Remove unused variable 'n' 2022-11-08 03:40:54 +00:00
csio_wr.h
Kconfig
Makefile
t4fw_api_stor.h