Re: ioctl arg passing

From: Matt (madmatt@bits.bris.ac.uk)
Date: Mon Apr 23 2001 - 14:58:54 EST


Matt aka Doofus festures mentioned the following:

| struct instruction_t local;
| __s16 *temp;
|
| copy_from_user( &local, ( struct instruction_t * ) arg, sizeof( struct instruction_t ) );
| temp = kmalloc( sizeof( __s16 ) * local.rxlen, GFP_KERNEL );
| copy_from_user( temp, arg, sizeof( __s16 ) * local.rxlen );

I meant that last line to be:

copy_from_user( temp, local.rxbuf, sizeof( __s16 ) * local.rxlen );
                      ^^^^^^^^^^^

Which'd clear up any confusion as to why I'd want two copies of the same
argument.

That's the main crux of my query, can I retrieve the value of a pointer
in some struct passed via ioctl? In this case, the struct/chunk of memory
referenced by local.rxbuf, (which is rxlen x 2 bytes big).

Apologies, I'm a muppet.

Matt

PS. Thanks for the help so far, I'd meant to add error checking and what
not, I just kept it out to keep the e-mail smaller.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Mon Apr 23 2001 - 21:00:46 EST