Skip to content

Commit d9f73af

Browse files
committed
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()
2 parents 53d22d8 + e913b14 commit d9f73af

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

sound/core/control.c

+5
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131

3232
/* max number of user-defined controls */
3333
#define MAX_USER_CONTROLS 32
34+
#define MAX_CONTROL_COUNT 1028
3435

3536
struct snd_kctl_ioctl {
3637
struct list_head list; /* list of all ioctls */
@@ -195,6 +196,10 @@ static struct snd_kcontrol *snd_ctl_new(struct snd_kcontrol *control,
195196

196197
if (snd_BUG_ON(!control || !control->count))
197198
return NULL;
199+
200+
if (control->count > MAX_CONTROL_COUNT)
201+
return NULL;
202+
198203
kctl = kzalloc(sizeof(*kctl) + sizeof(struct snd_kcontrol_volatile) * control->count, GFP_KERNEL);
199204
if (kctl == NULL) {
200205
snd_printk(KERN_ERR "Cannot allocate control instance\n");

sound/i2c/other/ak4xxx-adda.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -900,7 +900,7 @@ static int proc_init(struct snd_akm4xxx *ak)
900900
return 0;
901901
}
902902
#else /* !CONFIG_PROC_FS */
903-
static int proc_init(struct snd_akm4xxx *ak) {}
903+
static int proc_init(struct snd_akm4xxx *ak) { return 0; }
904904
#endif
905905

906906
int snd_akm4xxx_build_controls(struct snd_akm4xxx *ak)

0 commit comments

Comments
 (0)