linux-stable/drivers/scsi/csiostor
Arnd Bergmann 1849620fe5 scsi: csiostor: Avoid function pointer casts
[ Upstream commit 9f3dbcb563 ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-03-26 18:17:24 -04:00
..
Kconfig
Makefile
csio_attr.c
csio_defs.h scsi: csiostor: Avoid function pointer casts 2024-03-26 18:17:24 -04:00
csio_hw.c
csio_hw.h
csio_hw_chip.h
csio_hw_t5.c scsi: csiostor: Fix a typo 2021-03-24 22:54:24 -04:00
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-03-26 18:17:24 -04:00
csio_lnode.h scsi: csiostor: Avoid function pointer casts 2024-03-26 18:17:24 -04:00
csio_mb.c
csio_mb.h
csio_rnode.c
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
t4fw_api_stor.h