C copy_from_user question
Hi,
I'm trying to use the copy_from_user in kernel mode to copy a message from user's buffer this is the function for copy from user: Code:
asmlinkage long copyFrom(unsigned char *data, long length){ I tried using printk with %c %x %s but none works Code:
printk("data: %c" *content"); data[]{0x34, 0x65, 0x14} and sizeof(data) So how should I retrieve the correct data in the kernel mode? what should the printk be like? thanks |
Hello,
So you've passed 3 bytes in an array? I think you'd want to print them as Code:
printk("data: %x, %x, %x\n", content[0], content[1], content[2]); Also, where does your data variable come from? Are you sure are referencing the correct location in memory -- where those values were placed in user mode? Also, perhaps better to be using void *'s as are in the copy_from_user() signature: http://www.gnugeneration.com/mirrors...api/r4343.html |
All times are GMT -5. The time now is 03:10 AM. |