2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-21 11:44:01 +08:00

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>
This commit is contained in:
Takashi Iwai 2008-11-07 00:26:52 +01:00
parent c217429b14
commit b910d9ae5b

View File

@ -3399,7 +3399,10 @@ void *snd_array_new(struct snd_array *array)
{
if (array->used >= array->alloced) {
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)
return NULL;
if (array->list) {