linux-stable/sound/core
Takashi Iwai 5be5e93e39 ALSA: seq: fix function cast warnings
[ Upstream commit d7bf738098 ]

clang-16 points out a control flow integrity (kcfi) issue when event
callbacks get converted to incompatible types:

sound/core/seq/seq_midi.c:135:30: error: cast from 'int (*)(struct snd_rawmidi_substream *, const char *, int)' to 'snd_seq_dump_func_t' (aka 'int (*)(void *, void *, int)') converts to incompatible function type [-Werror,-Wcast-function-type-strict]
  135 |                 snd_seq_dump_var_event(ev, (snd_seq_dump_func_t)dump_midi, substream);
      |                                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sound/core/seq/seq_virmidi.c:83:31: error: cast from 'int (*)(struct snd_rawmidi_substream *, const unsigned char *, int)' to 'snd_seq_dump_func_t' (aka 'int (*)(void *, void *, int)') converts to incompatible function type [-Werror,-Wcast-function-type-strict]
   83 |                         snd_seq_dump_var_event(ev, (snd_seq_dump_func_t)snd_rawmidi_receive, vmidi->substream);
      |                                                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

For addressing those errors, introduce wrapper functions that are used
for callbacks and bridge to the actual function call with pointer
cast.

The code was originally added with the initial ALSA merge in linux-2.5.4.

[ the patch description shamelessly copied from Arnd's original patch
  -- tiwai ]

Fixes: 1da177e4c3 ("Linux-2.6.12-rc2")
Reported-by: Arnd Bergmann <arnd@arndb.de>
Link: https://lore.kernel.org/r/20240213101020.459183-1-arnd@kernel.org
Link: https://lore.kernel.org/r/20240213135343.16411-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-03-26 18:18:33 -04:00
..
oss ALSA: control: Introduce unlocked version for snd_ctl_find_*() helpers 2023-07-20 10:03:00 +02:00
seq ALSA: seq: fix function cast warnings 2024-03-26 18:18:33 -04:00
Kconfig ALSA: ump: Add legacy raw MIDI support 2023-05-23 12:11:09 +02:00
Makefile ALSA: Drop leftover snd-rtctimer stuff from Makefile 2024-03-06 14:53:52 +00:00
compress_offload.c ALSA: compress: Don't embed device 2023-08-17 09:24:15 +02:00
control.c ALSA: control: Don't embed ctl_dev 2023-08-17 09:23:30 +02:00
control_compat.c ALSA: control: Replace with __packed attribute 2023-10-26 09:42:43 +02:00
control_led.c ALSA: control: Don't embed ctl_dev 2023-08-17 09:23:30 +02:00
ctljack.c
device.c ALSA: core: Fix missing return value comments for kernel docs 2022-07-13 13:42:38 +02:00
hrtimer.c
hwdep.c ALSA: hwdep: Don't embed device 2023-08-17 09:24:01 +02:00
hwdep_compat.c
info.c ALSA: info: Fix potential deadlock at disconnection 2023-11-09 16:06:33 +01:00
info_oss.c
init.c ALSA: core: Use dev_name of card_dev as debugfs directory name 2023-09-12 15:30:37 +02:00
isadma.c sound updates for 6.0-rc1 2022-08-06 10:19:51 -07:00
jack.c ALSA: control: Take controls_rwsem lock in snd_ctl_remove() 2023-07-20 10:01:27 +02:00
memalloc.c ALSA: memalloc: Workaround for Xen PV 2023-01-27 09:16:24 +01:00
memalloc_local.h ALSA: memalloc: remove snd_dma_sg_ops declaration 2022-09-09 09:09:40 +02:00
memory.c ALSA: core: Add memory copy helpers between iov_iter and iomem 2023-08-18 12:18:16 +02:00
misc.c ALSA: core: Add async signal helpers 2022-07-29 12:57:10 +02:00
pcm.c ALSA: pcm: fix out-of-bounds in snd_pcm_state_names 2023-12-06 08:18:29 +01:00
pcm_compat.c ALSA: pcm: Fix missing fixup call in compat hw_refine ioctl 2023-08-29 16:03:11 +02:00
pcm_dmaengine.c ALSA: dmaengine: increment buffer pointer atomically 2022-09-27 08:55:05 +02:00
pcm_drm_eld.c ALSA: pcm: fix ELD constraints for (E)AC3, DTS(-HD) and MLP formats 2023-06-25 08:42:53 +02:00
pcm_iec958.c
pcm_lib.c ALSA: pcm: Fix error checks of default read/write copy ops 2023-09-02 08:11:48 +02:00
pcm_local.h ALSA: pcm: Revert "ALSA: pcm: rewrite snd_pcm_playback_silence()" 2023-05-05 18:23:48 +02:00
pcm_memory.c ALSA: pcm: Fix potential data race at PCM memory allocation helpers 2023-07-03 14:52:27 +02:00
pcm_misc.c
pcm_native.c sound updates for 6.7 2023-11-02 14:34:14 -10:00
pcm_param_trace.h
pcm_timer.c
pcm_trace.h ALSA: pcm: fix tracing reason in hw_ptr_error 2022-11-28 14:55:41 +01:00
rawmidi.c ALSA: rawmidi: Fix NULL dereference at proc read 2023-09-16 08:08:05 +02:00
rawmidi_compat.c ALSA: rawmidi: Replace with __packed attribute 2023-10-26 09:42:55 +02:00
seq_device.c
sound.c
sound_oss.c ALSA: oss: Fix potential deadlock at unregistration 2022-10-11 09:02:43 +02:00
timer.c ALSA: timer: Create device with snd_device_alloc() 2023-08-17 09:24:21 +02:00
timer_compat.c
ump.c ALSA: ump: Fix the discard error code from snd_ump_legacy_open() 2024-03-06 14:53:54 +00:00
ump_convert.c ALSA: ump: Correct wrong byte size at converting a UMP System message 2023-06-28 11:44:30 +02:00
vmaster.c ALSA: vmaster: Add snd_ctl_add_followers() helper 2023-07-21 09:37:47 +02:00