copy_to_user not working while implementing IOCTL

Abhinav Pathak abhinav.pathak at gmail.com
Fri Apr 28 15:54:59 EDT 2006


Hi

I am working on hostap-0.4.7 version. I am trying to transfer some
information from the driver to a user space code using copy_to_user
function.

I have made a new sub-ioctl which is called from the userspace program. The
user space program makes a iwreq structure and makes an ioctl call to this
sub-ioctl.

In the driver, I have made the following changes in
prism2_ioctl_priv_get_prism2_param

...
struct iw_point * data_p = (struct iw_point *) wrqu;
char temp[] = "This data needs to be passed to userspace";
int bytes_left;
...
...
...
case: MY_SUB_IOCTL:
     bytes_left = copy_to_user(data_p->pointer, temp, 40);
     //bytes_left = 40


All the bytes are left out by the copy_to_user . I verified whether
data_p->pointer is a valid place to write using
access_ok(VERIFY_WRITE, data_p->pointer, 40) which returned 1, meaning its
ok to write there.

Neither I am able to write to the user space .. nor able to read from there.
Am I missing some thing here... Or doing something wrong?

Could someone please help me out ..
Thnx

--
Abhinav Pathak
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.shmoo.com/pipermail/hostap/attachments/20060429/4722b34b/attachment.htm 


More information about the HostAP mailing list