Commit d9f73afc authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'fix/misc' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6

* 'fix/misc' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6:
  ALSA: i2c/other/ak4xx-adda: Fix a compile warning with CONFIG_PROCFS=n
  ALSA: prevent heap corruption in snd_ctl_new()
parents 53d22d88 e913b146
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
/* max number of user-defined controls */ /* max number of user-defined controls */
#define MAX_USER_CONTROLS 32 #define MAX_USER_CONTROLS 32
#define MAX_CONTROL_COUNT 1028
struct snd_kctl_ioctl { struct snd_kctl_ioctl {
struct list_head list; /* list of all ioctls */ struct list_head list; /* list of all ioctls */
...@@ -195,6 +196,10 @@ static struct snd_kcontrol *snd_ctl_new(struct snd_kcontrol *control, ...@@ -195,6 +196,10 @@ static struct snd_kcontrol *snd_ctl_new(struct snd_kcontrol *control,
if (snd_BUG_ON(!control || !control->count)) if (snd_BUG_ON(!control || !control->count))
return NULL; return NULL;
if (control->count > MAX_CONTROL_COUNT)
return NULL;
kctl = kzalloc(sizeof(*kctl) + sizeof(struct snd_kcontrol_volatile) * control->count, GFP_KERNEL); kctl = kzalloc(sizeof(*kctl) + sizeof(struct snd_kcontrol_volatile) * control->count, GFP_KERNEL);
if (kctl == NULL) { if (kctl == NULL) {
snd_printk(KERN_ERR "Cannot allocate control instance\n"); snd_printk(KERN_ERR "Cannot allocate control instance\n");
......
...@@ -900,7 +900,7 @@ static int proc_init(struct snd_akm4xxx *ak) ...@@ -900,7 +900,7 @@ static int proc_init(struct snd_akm4xxx *ak)
return 0; return 0;
} }
#else /* !CONFIG_PROC_FS */ #else /* !CONFIG_PROC_FS */
static int proc_init(struct snd_akm4xxx *ak) {} static int proc_init(struct snd_akm4xxx *ak) { return 0; }
#endif #endif
int snd_akm4xxx_build_controls(struct snd_akm4xxx *ak) int snd_akm4xxx_build_controls(struct snd_akm4xxx *ak)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment