mirror of
https://github.com/torvalds/linux.git
synced 2024-10-30 00:32:38 +00:00
ALSA: asihpi - Fix potential Oops in snd_asihpi_cmode_info()
Dan Carpenter reported that setting 0 to uinfo->value.enumerated.items in snd_asihpi_cmode_info() may lead to Oops. This function should return an error immediately in such a case instead. Cc: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
9badda0a0a
commit
74eeb141d3
@ -2259,6 +2259,9 @@ static int snd_asihpi_cmode_info(struct snd_kcontrol *kcontrol,
|
||||
valid_modes++;
|
||||
}
|
||||
|
||||
if (!valid_modes)
|
||||
return -EINVAL;
|
||||
|
||||
uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
|
||||
uinfo->count = 1;
|
||||
uinfo->value.enumerated.items = valid_modes;
|
||||
|
Loading…
Reference in New Issue
Block a user