Fix allocation of too big size
This commit is contained in:
parent
9815cc062f
commit
a254a7cd71
10
core/alloc.c
10
core/alloc.c
@ -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)
|
||||||
|
Loading…
Reference in New Issue
Block a user