linux/sound/pci/ctxfi
Arnd Bergmann aabdedf4d2 ALSA: ctxfi: avoid casting function pointers
This driver creates an abstraction for different components by casting function
pointers to slightly incompatible types for each one to get the correct
argument even when the caller does not know those types. This is a
bit unreliable and not allowed in combination with control flow integrity
(KCFI):

sound/pci/ctxfi/ctatc.c:115:25: error: cast from 'int (*)(struct hw *, struct src_mgr **)' to 'create_t' (aka 'int (*)(struct hw *, void **)') converts to incompatible function type [-Werror,-Wcast-function-type-strict]
  115 |         [SRC]           = { .create     = (create_t)src_mgr_create,
      |                                           ^~~~~~~~~~~~~~~~~~~~~~~~
sound/pci/ctxfi/ctatc.c:116:20: error: cast from 'int (*)(struct src_mgr *)' to 'destroy_t' (aka 'int (*)(void *)') converts to incompatible function type [-Werror,-Wcast-function-type-strict]
  116 |                             .destroy    = (destroy_t)src_mgr_destroy    },
      |                                           ^~~~~~~~~~~~~~~~~~~~~~~~~~
sound/pci/ctxfi/ctatc.c:117:27: error: cast from 'int (*)(struct hw *, struct srcimp_mgr **)' to 'create_t' (aka 'int (*)(struct hw *, void **)') converts to incompatible function type [-Werror,-Wcast-function-type-strict]
  117 |         [SRCIMP]        = { .create     = (create_t)srcimp_mgr_create,
      |                                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~
sound/pci/ctxfi/ctatc.c:118:20: error: cast from 'int (*)(struct srcimp_mgr *)' to 'destroy_t' (aka 'int (*)(void *)') converts to incompatible function type [-Werror,-Wcast-function-type-strict]
  118 |                             .destroy    = (destroy_t)srcimp_mgr_destroy },
      |                                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Change these to always pass void pointers and move the abstraction one level
down.

Fixes: 8cc7236148 ("ALSA: SB X-Fi driver merge")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Link: https://lore.kernel.org/r/20240213101303.460008-1-arnd@kernel.org
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2024-02-13 14:21:50 +01:00
..
ct20k1reg.h ALSA: ctxfi: fix comment syntax in file headers 2021-03-18 10:14:08 +01:00
ct20k2reg.h ALSA: ctxfi: fix comment syntax in file headers 2021-03-18 10:14:08 +01:00
ctamixer.c ALSA: ctxfi: avoid casting function pointers 2024-02-13 14:21:50 +01:00
ctamixer.h ALSA: ctxfi: avoid casting function pointers 2024-02-13 14:21:50 +01:00
ctatc.c ALSA: ctxfi: avoid casting function pointers 2024-02-13 14:21:50 +01:00
ctatc.h ALSA: ctxfi: fix comment syntax in file headers 2021-03-18 10:14:08 +01:00
ctdaio.c ALSA: ctxfi: avoid casting function pointers 2024-02-13 14:21:50 +01:00
ctdaio.h ALSA: ctxfi: avoid casting function pointers 2024-02-13 14:21:50 +01:00
cthardware.c ALSA: pci/ctxfi: fix kernel-doc warnings 2020-07-07 12:05:56 +02:00
cthardware.h ALSA: ctxfi: Add SB046x PCI ID 2022-05-23 09:47:07 +02:00
cthw20k1.c ALSA: ctxfi: fix typo in comment 2022-05-23 09:48:29 +02:00
cthw20k1.h ALSA: ctxfi: fix comment syntax in file headers 2021-03-18 10:14:08 +01:00
cthw20k2.c ALSA: ctxfi: cthw20k2: fix mask on conf to allow 4 bits 2021-02-28 09:12:41 +01:00
cthw20k2.h ALSA: ctxfi: fix comment syntax in file headers 2021-03-18 10:14:08 +01:00
ctimap.c ALSA: pci/ctxfi: fix kernel-doc warnings 2020-07-07 12:05:56 +02:00
ctimap.h ALSA: ctxfi: fix comment syntax in file headers 2021-03-18 10:14:08 +01:00
ctmixer.c ALSA: pci/ctxfi: fix kernel-doc warnings 2020-07-07 12:05:56 +02:00
ctmixer.h ALSA: ctxfi: fix comment syntax in file headers 2021-03-18 10:14:08 +01:00
ctpcm.c ALSA: Convert strlcpy to strscpy when return value is unused 2021-01-08 09:30:05 +01:00
ctpcm.h ALSA: ctxfi: fix comment syntax in file headers 2021-03-18 10:14:08 +01:00
ctresource.c ALSA: ctxfi: Fix out-of-range access 2021-11-18 22:57:55 +01:00
ctresource.h ALSA: ctxfi: Fix out-of-range access 2021-11-18 22:57:55 +01:00
ctsrc.c ALSA: ctxfi: avoid casting function pointers 2024-02-13 14:21:50 +01:00
ctsrc.h ALSA: ctxfi: avoid casting function pointers 2024-02-13 14:21:50 +01:00
cttimer.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 364 2019-06-05 17:37:09 +02:00
cttimer.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
ctvmem.c ALSA: ctxfi: fix comment syntax in file headers 2021-03-18 10:14:08 +01:00
ctvmem.h ALSA: ctxfi: fix comment syntax in file headers 2021-03-18 10:14:08 +01:00
Makefile treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
xfi.c module: remove never implemented MODULE_SUPPORTED_DEVICE 2021-03-17 13:16:18 -07:00