WSL2-Linux-Kernel/sound/pci/hda
Kuninori Morimoto 98e5eb1100 ALSA: hda/ca0132: fixup buffer overrun at tuning_ctl_set()
tuning_ctl_set() might have buffer overrun at (X) if it didn't break
from loop by matching (A).

	static int tuning_ctl_set(...)
	{
		for (i = 0; i < TUNING_CTLS_COUNT; i++)
(A)			if (nid == ca0132_tuning_ctls[i].nid)
				break;

		snd_hda_power_up(...);
(X)		dspio_set_param(..., ca0132_tuning_ctls[i].mid, ...);
		snd_hda_power_down(...);                ^

		return 1;
	}

We will get below error by cppcheck

	sound/pci/hda/patch_ca0132.c:4229:2: note: After for loop, i has value 12
	 for (i = 0; i < TUNING_CTLS_COUNT; i++)
	 ^
	sound/pci/hda/patch_ca0132.c:4234:43: note: Array index out of bounds
	 dspio_set_param(codec, ca0132_tuning_ctls[i].mid, 0x20,
	                                           ^
This patch cares non match case.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87sfe9eap7.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-03-14 17:04:53 +01:00
..
Kconfig
Makefile
ca0132_regs.h
cs35l41_hda.c
cs35l41_hda.h
cs35l41_hda_i2c.c
cs35l41_hda_spi.c
hda_auto_parser.c
hda_auto_parser.h
hda_beep.c
hda_beep.h
hda_bind.c
hda_codec.c
hda_component.h
hda_controller.c
hda_controller.h
hda_controller_trace.h
hda_cs_dsp_ctl.c
hda_cs_dsp_ctl.h
hda_eld.c
hda_generic.c
hda_generic.h
hda_hwdep.c
hda_intel.c ALSA: hda: Match only Intel devices with CONTROLLER_IN_GPU() 2023-03-08 06:38:51 +01:00
hda_intel.h
hda_intel_trace.h
hda_jack.c
hda_jack.h
hda_local.h
hda_proc.c
hda_sysfs.c
hda_tegra.c
hp_x360_helper.c
ideapad_s740_helper.c
patch_analog.c
patch_ca0110.c
patch_ca0132.c ALSA: hda/ca0132: fixup buffer overrun at tuning_ctl_set() 2023-03-14 17:04:53 +01:00
patch_cirrus.c
patch_cmedia.c
patch_conexant.c
patch_cs8409-tables.c
patch_cs8409.c
patch_cs8409.h
patch_hdmi.c
patch_realtek.c ALSA: hda/realtek: Fix the speaker output on Samsung Galaxy Book2 Pro 2023-03-08 06:38:18 +01:00
patch_si3054.c
patch_sigmatel.c
patch_via.c
thinkpad_helper.c