Skip to content

Commit d7f15be

Browse files
x2018tiwai
authored andcommitted
ALSA: lola: add a check for the return of vmalloc()
vmalloc() is a memory allocation function which can return NULL when some internal memory errors happen. So it is better to check the return of it to catch the error in time. Signed-off-by: Xiaoke Wang <xkernel.wang@foxmail.com> Link: https://lore.kernel.org/r/tencent_4221FC4089F6DF01C48F192E5784038BA205@qq.com Signed-off-by: Takashi Iwai <tiwai@suse.de>
1 parent 3cffb26 commit d7f15be

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

sound/pci/lola/lola_mixer.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,8 @@ int lola_init_mixer_widget(struct lola *chip, int nid)
121121

122122
/* reserve memory to copy mixer data for sleep mode transitions */
123123
chip->mixer.array_saved = vmalloc(sizeof(struct lola_mixer_array));
124+
if (!chip->mixer.array_saved)
125+
return -ENOMEM;
124126

125127
/* mixer matrix sources are physical input data and play streams */
126128
chip->mixer.src_stream_outs = chip->pcm[PLAY].num_streams;

0 commit comments

Comments
 (0)