linux-stable/sound/core
Takashi Iwai 0abbd9b5e9 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:17:05 -04:00
..
oss
seq ALSA: seq: fix function cast warnings 2024-03-26 18:17:05 -04:00
Kconfig
Makefile ALSA: Drop leftover snd-rtctimer stuff from Makefile 2024-02-21 10:23:02 +01:00
compress_offload.c
control.c
control_compat.c ALSA: control: Replace with __packed attribute 2023-10-26 09:42:43 +02:00
control_led.c
ctljack.c
device.c
hrtimer.c
hwdep.c
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
jack.c
memalloc.c
memalloc_local.h
memory.c
misc.c
pcm.c ALSA: pcm: Add missing formats to formats list 2024-01-30 14:11:02 +01:00
pcm_compat.c
pcm_dmaengine.c
pcm_drm_eld.c drm/edid: include drm_eld.h only where required 2023-11-09 16:47:31 +02:00
pcm_iec958.c
pcm_lib.c ALSA: hda: Upgrade stream-format infrastructure 2023-11-27 17:27:41 +01:00
pcm_local.h
pcm_memory.c
pcm_misc.c
pcm_native.c ALSA: pcm: clarify and fix default msbits value for all formats 2024-02-23 09:44:46 +01:00
pcm_param_trace.h
pcm_timer.c
pcm_trace.h
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
timer.c
timer_compat.c
ump.c ALSA: ump: Fix the discard error code from snd_ump_legacy_open() 2024-02-20 17:06:12 +01:00
ump_convert.c
vmaster.c