hi, I am a newbie into linux programming. Ps help me with a small problem i am facing while writing a sample program for a driver module. I have a structure like struct devstruct { char* string; int len; }; I want to return information from the driver to a user process which queries me with ioctl. The code has the following outline... USER PROCESS ........... struct devstruct var; ioctl(fd, READ_COMMAND, &var); printf("%s",var.string); ..................... DRIVER Module char* data="hello"; int len=5; int myioctl (struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg){ switch(cmd) { ............. case READ_COMMAND: { ..... struct devstruct* var = (struct devstruct*)arg; var->len = len; /********* allocate memory in user space? **********/ var->string = (allocate memory = len+1 in user space) copy_to_user(var->string,data,len+1); ..... } break; ............. } } My question is that how do i allocate memory in user space when i am in kernel space or will copy_to_user do it automatically?. is there a variant of kmalloc or what?? Thanks in advance Mandeep -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/