From: Takashi Iwai Date: Wed, 10 Oct 2012 06:59:14 +0000 (+0200) Subject: ALSA: hda - Warn an allocation for an uninitialized array X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=12f1771709ea53f11cf633c065d6160769795f24;p=linux.git ALSA: hda - Warn an allocation for an uninitialized array Better to add a sanity check as I tend to forget something (especially during crazy midsummer nights). Signed-off-by: Takashi Iwai --- diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index c0ab72cbeed12..70d4848b5cd0a 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c @@ -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;