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
1 changed files with 8 additions and 2 deletions

View File

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