summaryrefslogtreecommitdiff
path: root/sound/core/control.c
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2010-10-12 17:27:20 +0200
committerThomas Gleixner <tglx@linutronix.de>2010-10-12 17:27:28 +0200
commit37eca0d64a2dbeece25969ec0698e1ff72bdcf39 (patch)
tree54ba70f0428f586f4fe28d8b429b9f9e0799a17a /sound/core/control.c
parent277b199800ac90811ac86d215063df1984f51619 (diff)
parent3c06806e690885ce978ef180c8f8b6f8c17fb4b4 (diff)
Merge branch 'linus' into core/locking
Reason: Pull in the semaphore related changes Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'sound/core/control.c')
-rw-r--r--sound/core/control.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/sound/core/control.c b/sound/core/control.c
index 070aab490191..45a818002d99 100644
--- a/sound/core/control.c
+++ b/sound/core/control.c
@@ -31,6 +31,7 @@
/* max number of user-defined controls */
#define MAX_USER_CONTROLS 32
+#define MAX_CONTROL_COUNT 1028
struct snd_kctl_ioctl {
struct list_head list; /* list of all ioctls */
@@ -195,6 +196,10 @@ static struct snd_kcontrol *snd_ctl_new(struct snd_kcontrol *control,
if (snd_BUG_ON(!control || !control->count))
return NULL;
+
+ if (control->count > MAX_CONTROL_COUNT)
+ return NULL;
+
kctl = kzalloc(sizeof(*kctl) + sizeof(struct snd_kcontrol_volatile) * control->count, GFP_KERNEL);
if (kctl == NULL) {
snd_printk(KERN_ERR "Cannot allocate control instance\n");