Skip to content

Commit

Permalink
sound: snd_ctl_elem_add: fix value count check
Browse files Browse the repository at this point in the history
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 <clemens@ladisch.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
  • Loading branch information
Clemens Ladisch authored and Takashi Iwai committed Aug 17, 2009
1 parent 64f1607 commit 2a031ae
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion sound/core/control.c
Original file line number Diff line number Diff line change
Expand Up @@ -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|
Expand Down

0 comments on commit 2a031ae

Please sign in to comment.