If I'm reading Talib's question correctly, it looks like he is
treating the pointer as opaque in user space, i.e. not directly
referencing the memory in user space, but he is passing the pointer back
to his kernel module at some point in the future, and he wants to make
sure that on this subsequent call the pointer is still valid. Without
seeing his code and knowing exactly what he is trying to accomplish, I
can't say for sure. Whatever the case, for saving opaque kernel
pointers I would use the private_data field in the file structure,
assuming this is a driver or virtual file system he is working with.
Bob
Bob, you are correct.
When using application wants service from my device, it open character
special file and get a descriptor. Now through ioctl it can make hundreds of
request to my device.
Driver (i.e. my code) allocate memory for each request (through slab cache).
There could be many transections for each request. (think if you open a for
file you can do read, write operations).
And all I want to make sure that application (by mistake or by choice) is
not passing a junk value to my code. Once, I verify that memory is OK, than
I can look for signatures to make sure that it is pointing to correct data
structure.
Talib
_________________________________________________________________
On the road to retirement? Check out MSN Life Events for advice on how to
get there! http://lifeevents.msn.com/category.aspx?cid=Retirement
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive: http://mail.nl.linux.org/kernelnewbies/
FAQ: http://kernelnewbies.org/faq/