copy_to_user question

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

 



Hi all, i have a question about copy_to_user function.
I have a module which declares a struct test { int size; char *name; int
value_add };
I like to transfer that struct to userspace through an ioctl command like
that:

struct test test_struct;
memset(&test_struct,0,sizeof(test_struct);
test_struct.size= 100;
test_struct.name = "test name";
test_struct.value_add = 2;
copy_to_user((void __user *)arg,&test_struct,sizeof(struct test));


When i use the ioctl command in user-space and try to get the name item a
segfault occurs.Can u tell me why??
Can we transfer from kernel-space to user-space pointers like the one i use
or this is a fault approach???


Best regards,
Chris.


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux