Re: driver copy_to_user

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

 



Hi...:)

On Fri, Dec 24, 2010 at 13:40, Hemanth Kumar <hemwire@xxxxxxxxxxx> wrote:
> Hi mulyadi,
>
>          Sorry for sending the mail directly,

It's ok, but just to let you know..I am just average when dealing with kernel :)

> ssize_t my_read(struct file *file,char *buf,size_t count,loff_t *pos){
>     unsigned long res;
>     void *k = (void *)&x;
>          void *l = (void *)&x+1;
>          void *j = (void *)&x+2;
>
>                     mutex_lock(&timer);
>                             res =    copy_to_user(buf,k,sizeof(short));


hm, you say "read from user space", right? Then why "copy_to_user"?
shouldn't it be "copy_from_user"?
-- 
regards,

Mulyadi Santosa
Freelance Linux trainer and consultant

blog: the-hydra.blogspot.com
training: mulyaditraining.blogspot.com

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies



[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