Skip to contentSkip to conversation

driver copy_to_user

DISCUSSION Mulyadi Santosa 1 participant 1 message Dec 24, 2010 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

Hi...:)

Quoted 3 lines · Hemanth Kumar

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 :)

Quoted 8 lines

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"?

Signature · 7 lines
regards,

Mulyadi Santosa
Freelance Linux trainer and consultant

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