You cannot use the standard functions of the c library, such as malloc()or calloc()inside the kernel, the code that you write in the kernel links to the functionality provided by the kernel itself.
You can use kmalloc () and then free it with kfree () .
source
share