ALSA: hda - Warn an allocation for an uninitialized array
authorTakashi Iwai <tiwai@suse.de>
Wed, 10 Oct 2012 06:59:14 +0000 (08:59 +0200)
committerTakashi Iwai <tiwai@suse.de>
Wed, 10 Oct 2012 07:24:08 +0000 (09:24 +0200)
Better to add a sanity check as I tend to forget something (especially
during crazy midsummer nights).

Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/pci/hda/hda_codec.c

index c0ab72cbeed1288da505468e27e42b3dca984b3f..70d4848b5cd0ad25ce272877f9c759ed010dfc58 100644 (file)
@@ -5168,6 +5168,8 @@ EXPORT_SYMBOL_HDA(snd_hda_resume);
  */
 void *snd_array_new(struct snd_array *array)
 {
+       if (snd_BUG_ON(!array->elem_size))
+               return NULL;
        if (array->used >= array->alloced) {
                int num = array->alloced + array->alloc_align;
                int size = (num + 1) * array->elem_size;