OpenCloudOS-Kernel/sound/core/seq
Takashi Iwai 435e7f6474 ALSA: seq: fix function cast warnings
[ Upstream commit d7bf73809849463f76de42aad62c850305dd6c5d ]

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:19:47 -04:00
..
oss ALSA: seq: oss: Fix racy open/close of MIDI devices 2023-06-16 09:26:41 +02:00
Kconfig ALSA: seq: Bind UMP device 2023-05-23 12:11:33 +02:00
Makefile ALSA: seq: Bind UMP device 2023-05-23 12:11:33 +02:00
seq.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156 2019-05-30 11:26:35 -07:00
seq_clientmgr.c ALSA: seq: Create device with snd_device_alloc() 2023-08-17 09:24:28 +02:00
seq_clientmgr.h ALSA: seq: Add UMP group filter 2023-05-23 12:11:38 +02:00
seq_compat.c ALSA: seq: Add ioctls for client UMP info query and setup 2023-05-23 12:11:36 +02:00
seq_dummy.c ALSA: seq: Allow suppressing UMP conversions 2023-05-23 12:11:32 +02:00
seq_fifo.c ALSA: seq: Fix assignment in if condition 2021-06-09 17:30:26 +02:00
seq_fifo.h ALSA: seq: Fix potential concurrent access to the deleted pool 2019-08-25 09:31:10 +02:00
seq_info.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156 2019-05-30 11:26:35 -07:00
seq_info.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156 2019-05-30 11:26:35 -07:00
seq_lock.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156 2019-05-30 11:26:35 -07:00
seq_lock.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
seq_memory.c ALSA: seq: Fix snd_seq_expand_var_event() call to user-space 2023-09-05 10:13:46 +02:00
seq_memory.h ALSA: seq: Add UMP support 2023-05-23 12:11:21 +02:00
seq_midi.c ALSA: seq: fix function cast warnings 2024-03-26 18:19:47 -04:00
seq_midi_emul.c ALSA: Use fallthrough pseudo-keyword 2020-07-09 13:01:29 +02:00
seq_midi_event.c ALSA: seq: More constifications 2020-01-05 16:14:29 +01:00
seq_ports.c ALSA: seq: Fix memory leak at error path in snd_seq_create_port() 2023-07-17 08:26:15 +02:00
seq_ports.h ALSA: seq: Automatic conversion of UMP events 2023-05-23 12:11:28 +02:00
seq_prioq.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156 2019-05-30 11:26:35 -07:00
seq_prioq.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156 2019-05-30 11:26:35 -07:00
seq_queue.c ALSA: seq: Set upper limit of processed events 2021-12-07 17:52:28 +01:00
seq_queue.h ALSA: seq: Use bool for snd_seq_queue internal flags 2020-12-06 09:35:53 +01:00
seq_system.c ALSA: seq: ump: Notify port changes to system port 2023-06-12 18:22:32 +02:00
seq_system.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156 2019-05-30 11:26:35 -07:00
seq_timer.c ALSA: seq: Fix race of snd_seq_timer_open() 2021-06-10 17:21:30 +02:00
seq_timer.h ALSA: seq: Fix concurrent access to queue current tick/time 2020-02-14 15:53:09 +01:00
seq_ump_client.c ALSA: seq: ump: Fix -Wformat-truncation warning 2023-09-15 13:21:29 +02:00
seq_ump_convert.c ALSA: seq: Avoid delivery of events for disabled UMP groups 2023-09-12 10:52:28 +02:00
seq_ump_convert.h ALSA: seq: Automatic conversion of UMP events 2023-05-23 12:11:28 +02:00
seq_virmidi.c ALSA: seq: fix function cast warnings 2024-03-26 18:19:47 -04:00