copy_to_user not working while implementing IOCTL

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


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

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

In the driver, I have made the following changes in

struct iw_point * data_p = (struct iw_point *) wrqu;
char temp[] = "This data needs to be passed to userspace";
int bytes_left;
     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 ..

Abhinav Pathak
-------------- next part --------------
An HTML attachment was scrubbed...

More information about the HostAP mailing list