kernel_samsung_a53x/drivers/scsi/csiostor
Arnd Bergmann 51596dfaaa scsi: csiostor: Avoid function pointer casts
[ Upstream commit 9f3dbcb5632d6876226031d552ef6163bb3ad215 ]

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: a3667aaed569 ("[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-11-19 08:44:57 +01:00
..
csio_attr.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
csio_defs.h scsi: csiostor: Avoid function pointer casts 2024-11-19 08:44:57 +01:00
csio_hw.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
csio_hw.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
csio_hw_chip.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
csio_hw_t5.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
csio_init.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
csio_init.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
csio_isr.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
csio_lnode.c scsi: csiostor: Avoid function pointer casts 2024-11-19 08:44:57 +01:00
csio_lnode.h scsi: csiostor: Avoid function pointer casts 2024-11-19 08:44:57 +01:00
csio_mb.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
csio_mb.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
csio_rnode.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
csio_rnode.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
csio_scsi.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
csio_scsi.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
csio_wr.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
csio_wr.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
Kconfig Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
Makefile Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
t4fw_api_stor.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00