If you're not familiar with the kernel you will probably try to use some specific thing from the C standard library only to find out that it doesn't work or isn't defined. You're looking at kmalloc() as the kernel equivalent for malloc(), though I think normally for something like a device driver you'd allocate pages of memory (via one of the __alloc_pages related calls) and manage it yourself from there. The best way is to use the source, look at other examples and search the code. But there is an API, and most common things have not really changed for decades now