sandbox: vm: make kmalloc(size: 0) return NULL
This commit is contained in:
@@ -28,6 +28,10 @@ static const size_t nr_size_n_caches = sizeof size_n_caches / sizeof size_n_cach
|
|||||||
|
|
||||||
void *kmalloc(size_t count, vm_flags_t flags)
|
void *kmalloc(size_t count, vm_flags_t flags)
|
||||||
{
|
{
|
||||||
|
if (!count) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
vm_cache_t *best_fit = NULL;
|
vm_cache_t *best_fit = NULL;
|
||||||
for (size_t i = 0; i < nr_size_n_caches; i++) {
|
for (size_t i = 0; i < nr_size_n_caches; i++) {
|
||||||
if (size_n_caches[i].c_obj_size >= count) {
|
if (size_n_caches[i].c_obj_size >= count) {
|
||||||
|
|||||||
Reference in New Issue
Block a user