summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2012-01-09 18:26:05 +0100
committerTakashi Iwai <tiwai@suse.de>2012-01-09 18:27:54 +0100
commit74eeb141d3bdf5a9a65c84dd637c41f12c40f41c (patch)
tree819cfbefd802e9e4c7daefd9055d59e632343228
parent9badda0a0afffebbe1cb30565800896534a6c5bd (diff)
downloadlinux-3.10-74eeb141d3bdf5a9a65c84dd637c41f12c40f41c.tar.gz
linux-3.10-74eeb141d3bdf5a9a65c84dd637c41f12c40f41c.tar.bz2
linux-3.10-74eeb141d3bdf5a9a65c84dd637c41f12c40f41c.zip
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>
-rw-r--r--sound/pci/asihpi/asihpi.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/sound/pci/asihpi/asihpi.c b/sound/pci/asihpi/asihpi.c
index fd3926fb0a0..e8de831f98b 100644
--- a/sound/pci/asihpi/asihpi.c
+++ b/sound/pci/asihpi/asihpi.c
@@ -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;