linux/sound/core
Dan Carpenter a04dae6fa4 ALSA: silence integer wrapping warning
This patch doesn't change runtime at all, it's just for kernel hardening.

The "count" here comes from the user and on 32bit systems, it leads to
integer wrapping when we pass it to compute_user_elem_size():

	alloc_size = compute_user_elem_size(private_size, count);

However, the integer over is harmless because later "count" is checked
when we pass it to snd_ctl_new():

	err = snd_ctl_new(&kctl, count, access, file);

These days as part of kernel hardening we're trying to avoid integer
overflows when they affect size_t type.  So to avoid the integer overflow
copy the check from snd_ctl_new() and do it at the start of the
snd_ctl_elem_add() function as well.

Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: Jaroslav Kysela <perex@perex.cz>
Link: https://patch.msgid.link/5457e8c1-01ff-4dd9-b49c-15b817f65ee7@stanley.mountain
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2024-10-01 14:56:40 +02:00
..
oss ALSA: mixer_oss: Remove some incorrect kfree_const() usages 2024-09-30 10:12:08 +02:00
seq Merge branch 'topic/seq-filter-cleanup' into for-next 2024-08-19 10:48:46 +02:00
.kunitconfig ALSA: core: add kunitconfig 2024-03-17 09:36:45 +01:00
compress_offload.c ALSA: Fix typos in comments across various files 2024-09-30 09:52:31 +02:00
control_compat.c Merge branch 'topic/control-lookup-rwlock' into for-next 2024-08-09 14:25:24 +02:00
control_led.c Merge branch 'topic/control-lookup-rwlock' into for-next 2024-08-09 14:25:24 +02:00
control.c ALSA: silence integer wrapping warning 2024-10-01 14:56:40 +02:00
ctljack.c ALSA: Convert strlcpy to strscpy when return value is unused 2021-01-08 09:30:05 +01:00
device.c ALSA: core: Fix missing return value comments for kernel docs 2022-07-13 13:42:38 +02:00
hrtimer.c ALSA: hrtimer: Use guard() for locking 2024-02-28 15:01:20 +01:00
hwdep_compat.c ALSA: compat_ioctl: avoid compat_alloc_user_space 2020-09-21 10:37:07 +02:00
hwdep.c ALSA: hwdep: Move put_user() call out of scoped_guard() in snd_hwdep_control_ioctl() 2024-03-01 18:10:57 +01:00
info_oss.c ALSA: info: Use guard() for locking 2024-02-28 15:01:21 +01:00
info.c ALSA: info: Use guard() for locking 2024-02-28 15:01:21 +01:00
init.c ALSA: control: Rename ctl_files_rwlock to controls_rwlock 2024-08-09 14:24:55 +02:00
isadma.c sound updates for 6.0-rc1 2022-08-06 10:19:51 -07:00
jack.c ALSA: core: Remove debugfs at disconnection 2024-05-27 09:28:21 +02:00
Kconfig ALSA: timer: Introduce virtual userspace-driven timers 2024-08-18 09:55:54 +02:00
Makefile ALSA: core: Use *-y instead of *-objs in Makefile 2024-05-08 18:17:32 +02:00
memalloc.c ALSA: memalloc: Use proper DMA mapping API for x86 S/G buffer allocations 2024-09-12 18:02:18 +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: Drop snd_print stuff and co 2024-08-08 07:49:47 +02:00
pcm_compat.c ALSA: pcm: Use guard() for PCM stream locks 2024-02-28 15:01:22 +01:00
pcm_dmaengine.c ALSA: pcm_dmaengine: Don't synchronize DMA channel when DMA is paused 2024-07-17 10:39:47 +02:00
pcm_drm_eld.c drm/edid: include drm_eld.h only where required 2023-11-09 16:47:31 +02:00
pcm_iec958.c ALSA: iec958: Split status creation and fill 2021-06-08 17:05:41 +02:00
pcm_lib.c ALSA: pcm: Add xrun counter for snd_pcm_substream 2024-08-10 10:40:58 +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 yet more compile warning at replacement with kstrtoul() 2024-09-02 10:17:42 +02:00
pcm_misc.c ALSA: pcm: Fix breakage of PCM rates used for topology 2024-09-11 16:17:44 +02:00
pcm_native.c ALSA: Fix typos in comments across various files 2024-09-30 09:52:31 +02:00
pcm_param_trace.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
pcm_timer.c ALSA: pcm_timer: use snd_pcm_direction_name() 2024-08-01 12:50:13 +02:00
pcm_trace.h tracing/treewide: Remove second parameter of __assign_str() 2024-05-22 20:14:47 -04:00
pcm.c ALSA: pcm: Add xrun counter for snd_pcm_substream 2024-08-10 10:40:58 +02:00
rawmidi_compat.c ALSA: rawmidi: Replace with __packed attribute 2023-10-26 09:42:55 +02:00
rawmidi.c ALSA: rawmidi: Use guard() for locking 2024-02-28 15:01:21 +01:00
seq_device.c driver core: have match() callback in struct bus_type take a const * 2024-07-03 15:16:54 +02:00
sound_kunit.c ALSA: kunit: Add missing module descriptions 2024-05-09 10:13:07 +02:00
sound_oss.c ALSA: core: Use guard() for locking 2024-02-28 15:01:21 +01:00
sound.c ALSA: Fix typos in comments across various files 2024-09-30 09:52:31 +02:00
timer_compat.c ALSA: timer: Use guard() for locking 2024-02-28 15:01:20 +01:00
timer.c ALSA: core: Drop superfluous no_free_ptr() for memdup_user() errors 2024-09-02 10:21:41 +02:00
ump_convert.c ALSA: ump: Explicitly reset RPN with Null RPN 2024-07-31 15:08:39 +02:00
ump.c ALSA: ump: Use %*ph to print small buffer 2024-09-12 08:40:51 +02:00
vmaster.c ALSA: vmaster: Return error for invalid input values 2024-06-18 12:00:18 +02:00