lx_emul: enhance krealloc implementation

Issue #4253
This commit is contained in:
Norman Feske 2021-07-23 17:53:50 +02:00 committed by Christian Helmuth
parent 149bd999f3
commit 36af114d78

View File

@ -25,9 +25,19 @@ void * krealloc(const void * p,size_t new_size,gfp_t flags)
if (!new_size) {
kfree(p);
return NULL;
}
lx_emul_trace_and_stop(__func__);
} else {
unsigned long const old_size = ksize(p);
void *ret;
if (new_size <= old_size)
return p;
ret = kmalloc(new_size, flags);
memcpy(ret, p, old_size);
return ret;
}
}