Is it possible to allocate to allocate memory for char * variable defined in user program from
I would put things in detail with the below code.
The below code is part of character driver . "xxx_read" function is called by a user program passing
a char * pointer (buf in below code).
ssize_t xxx_read (struct file *filp, char *buf, size_t count, loff_t *pos)
printk("PROCESS %i (%s) GOING TO SLEEP\n",current->pid, current->comm);
// initialize 'modifiedFile"
// can i use: buf = (char *) kmalloc(sizeof(modifiedFile), GFP_KERNEL);
What i need is whether i can use kmalloc for the variable "buf" inside the "xxx_read" and free the
memory using "free" in my user program which calls the kernel read function.