Fix allocation of too big size

This commit is contained in:
Mathieu Maret 2021-01-16 22:43:43 +01:00
parent 9815cc062f
commit a254a7cd71

View File

@ -205,10 +205,10 @@ static void *allocFromSlab(struct slabEntry *slab)
void *malloc(size_t size)
{
int flags;
struct slabDesc *slab;
struct slabDesc *slab = NULL;
uint slubIdx;
void *ret;
int flags;
disable_IRQs(flags);
@ -217,6 +217,12 @@ void *malloc(size_t size)
if (size <= slab->size)
break;
}
if (!list_foreach_early_break(slub, slab, slubIdx)) {
pr_devel("No slab found for %d\n", size);
return NULL;
}
struct slabEntry *slabEntry;
int slabIdx;
list_foreach(&slab->slab, slabEntry, slabIdx)