c - Copying data from a __user pointer -
i have access data pointer in struct iw_point
variable on linux based embedded board. pointer contained in struct
of type __user
. when try access location, program keeps segfaulting.
when looked @ memory location pointed pointer, noticed location not lie in address space of process has read location(obtained reading /proc/pid/maps
):
00400000-0048c000 r-xp 00000000 1f:04 83 /root/aravind/smapp 0049b000-0049c000 rw-p 0008b000 1f:04 83 /root/aravind/smapp
the location returned pointer e80000 not lie in range returned above.
does mean location lies outside address space of program triggering pointer return in first place(the pointer returned ioctl call)?
the siocgiwscan ioctl uses space hand in
iwr.u.data.pointer = p; iwr.u.data.length = bufsz;
with request return scanned network information because ioctl not able allocate return area in user space. check initialized pointer , data length (4k buffer space recommended). in case didn't, might such undefined results.
also make sure check return value ioctl
- in error case, don't try access return area.
in case did , still doesn't return valid pointer: there still number of drivers around don't support wireless extensions.
also bit of code make answer easier - stated question, hard answer without poking around , guessing lot.
Comments
Post a Comment