diff options
author | Takashi Iwai <tiwai@suse.de> | 2008-11-06 18:26:52 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2008-11-06 18:26:52 -0500 |
commit | b910d9ae5b370cf5bf9d6a71028119861b6ea8a4 (patch) | |
tree | ef02ccd3960de74b873a9ec95ab73ef06127b08f /sound/pci/hda/hda_codec.c | |
parent | c217429b14708999d6ac5de964c452600e8797d3 (diff) |
ALSA: hda - Add max allocation check in array allocator
Added a check for max allocation size in snd_array_new() for a
debugging purpose.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/hda/hda_codec.c')
-rw-r--r-- | sound/pci/hda/hda_codec.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index f13834ba6b1d..6f170b281e85 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c | |||
@@ -3399,7 +3399,10 @@ void *snd_array_new(struct snd_array *array) | |||
3399 | { | 3399 | { |
3400 | if (array->used >= array->alloced) { | 3400 | if (array->used >= array->alloced) { |
3401 | int num = array->alloced + array->alloc_align; | 3401 | int num = array->alloced + array->alloc_align; |
3402 | void *nlist = kcalloc(num + 1, array->elem_size, GFP_KERNEL); | 3402 | void *nlist; |
3403 | if (snd_BUG_ON(num >= 4096)) | ||
3404 | return NULL; | ||
3405 | nlist = kcalloc(num + 1, array->elem_size, GFP_KERNEL); | ||
3403 | if (!nlist) | 3406 | if (!nlist) |
3404 | return NULL; | 3407 | return NULL; |
3405 | if (array->list) { | 3408 | if (array->list) { |