You need to sign in or sign up before continuing.
提交 543f8d78 编写于 作者: J Jaroslav Kysela 提交者: Takashi Iwai

ALSA: control_led - fix the stack usage (control element ops)

It's a bad idea to allocate big structures on the stack.
Mark the variables as static and add a note for the locking.

Fixes: 22d8de62 ("ALSA: control - add generic LED trigger module as the new control layer")
Cc: Nathan Chancellor <nathan@kernel.org>
Cc: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: NJaroslav Kysela <perex@perex.cz>
Link: https://lore.kernel.org/r/20210414105858.1937710-1-perex@perex.czSigned-off-by: NTakashi Iwai <tiwai@suse.de>
上级 d2e8f641
...@@ -94,11 +94,15 @@ static struct snd_ctl_led *snd_ctl_led_get_by_access(unsigned int access) ...@@ -94,11 +94,15 @@ static struct snd_ctl_led *snd_ctl_led_get_by_access(unsigned int access)
return &snd_ctl_leds[group]; return &snd_ctl_leds[group];
} }
/*
* A note for callers:
* The two static variables info and value are protected using snd_ctl_led_mutex.
*/
static int snd_ctl_led_get(struct snd_ctl_led_ctl *lctl) static int snd_ctl_led_get(struct snd_ctl_led_ctl *lctl)
{ {
static struct snd_ctl_elem_info info;
static struct snd_ctl_elem_value value;
struct snd_kcontrol *kctl = lctl->kctl; struct snd_kcontrol *kctl = lctl->kctl;
struct snd_ctl_elem_info info;
struct snd_ctl_elem_value value;
unsigned int i; unsigned int i;
int result; int result;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册