Commit b910d9ae authored by Takashi Iwai's avatar Takashi Iwai

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: default avatarTakashi Iwai <tiwai@suse.de>
parent c217429b
...@@ -3399,7 +3399,10 @@ void *snd_array_new(struct snd_array *array) ...@@ -3399,7 +3399,10 @@ void *snd_array_new(struct snd_array *array)
{ {
if (array->used >= array->alloced) { if (array->used >= array->alloced) {
int num = array->alloced + array->alloc_align; int num = array->alloced + array->alloc_align;
void *nlist = kcalloc(num + 1, array->elem_size, GFP_KERNEL); void *nlist;
if (snd_BUG_ON(num >= 4096))
return NULL;
nlist = kcalloc(num + 1, array->elem_size, GFP_KERNEL);
if (!nlist) if (!nlist)
return NULL; return NULL;
if (array->list) { if (array->list) {
......
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