From: Clemens Ladisch Date: Mon, 17 Aug 2009 10:25:52 +0000 (+0200) Subject: sound: snd_ctl_elem_add: fix value count check X-Git-Tag: firefly_0821_release~12220^2~32^2~3 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=2a031aedf7f574a01eb725507cb303d4d7b8b23a;p=firefly-linux-kernel-4.4.55.git sound: snd_ctl_elem_add: fix value count check Make sure that no user element that has no values can be added. The check for count>1024 is not needed because the count is checked later for the individual control types. Signed-off-by: Clemens Ladisch Signed-off-by: Takashi Iwai --- diff --git a/sound/core/control.c b/sound/core/control.c index 17b8d47a5cd0..66d6aaf9314c 100644 --- a/sound/core/control.c +++ b/sound/core/control.c @@ -951,7 +951,7 @@ static int snd_ctl_elem_add(struct snd_ctl_file *file, if (card->user_ctl_count >= MAX_USER_CONTROLS) return -ENOMEM; - if (info->count > 1024) + if (info->count < 1) return -EINVAL; access = info->access == 0 ? SNDRV_CTL_ELEM_ACCESS_READWRITE : (info->access & (SNDRV_CTL_ELEM_ACCESS_READWRITE|