On Thu, Apr 20, 2006 at 10:42:16PM +0000, Talib Alim wrote:
> > 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
I really don't understand what you are trying to do :)
You want to pass the kernel pointer to the userspace application and
then pass back the kernel pointer from the user application to the
kernel ??
You can't do any operation from the user space on the kernel pointer,
so why do you want to pass it to the user space application ?
So that next time user calls my driver for service, it can identify context
of request (like fd in read)
_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today - it's FREE!
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive: http://mail.nl.linux.org/kernelnewbies/
FAQ: http://kernelnewbies.org/faq/