RE: copy_to/from_use query?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Does this work for you ? 

> 
> struct data {
>      int len;
>      int *p_len;
> };
> 
> struct data*  make_local_copy(unsigned long arg) {
>      struct data *p_usr_data = (struct data*)arg;
>      struct data *p_kernel_data =
>           (struct data*) kmalloc(sizeof(struct data), GFP_KERNEL);

       int *temp;
> 
>      copy_from_usr(p_kernel_data, p_usr_data, sizeof(*p_usr_data));
> 

       temp = p_kernel_data->p_len;

>      p_kernel_data->p_len =
>           (int*) kmalloc(p_kernel_data->len, GFP_KERNEL);
> 
// >      copy_from_usr(p_kernel_data->p_len,
// >            p_usr_data->p_len, p_kernel_data->len);

      copy_from_usr(p_kernel_data->p_len,
               temp, p_kernel_data->len);

>         /* ^^^^^^^^^^^^^ */
>      return p_kernel_data;
> }
> 
> Regards
> Mohanlal
> 
> 
> --
> Kernelnewbies: Help each other learn about the Linux kernel.
> Archive:       http://mail.nl.linux.org/kernelnewbies/
> FAQ:           http://kernelnewbies.org/faq/
> 
> 

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux