linux-stable/sound/core/seq
Takashi Iwai eca94a4b07 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:21:57 -04:00
..
oss ALSA: seq: oss: Fix racy open/close of MIDI devices 2023-09-19 12:20:06 +02:00
Kconfig
Makefile
seq.c
seq_clientmgr.c ALSA: seq: Fix data-race at module auto-loading 2022-09-08 11:11:40 +02:00
seq_clientmgr.h
seq_compat.c
seq_dummy.c
seq_fifo.c
seq_fifo.h
seq_info.c
seq_info.h
seq_lock.c
seq_lock.h
seq_memory.c ALSA: seq: Fix function prototype mismatch in snd_seq_expand_var_event 2022-12-14 11:31:53 +01:00
seq_memory.h
seq_midi.c ALSA: seq: fix function cast warnings 2024-03-26 18:21:57 -04:00
seq_midi_emul.c
seq_midi_event.c
seq_ports.c
seq_ports.h
seq_prioq.c
seq_prioq.h
seq_queue.c
seq_queue.h
seq_system.c
seq_system.h
seq_timer.c
seq_timer.h
seq_virmidi.c ALSA: seq: fix function cast warnings 2024-03-26 18:21:57 -04:00