From: Ingo Oeser <ingo.oeser@informatik.tu-chemnitz.de>
To: Matt <madmatt@bits.bris.ac.uk>
Cc: linux-kernel@vger.kernel.org
Subject: Re: ioctl arg passing
Date: Mon, 23 Apr 2001 23:33:12 +0200 [thread overview]
Message-ID: <20010423233312.Y682@nightmaster.csn.tu-chemnitz.de> (raw)
In-Reply-To: <Pine.LNX.4.21.0104231648330.1089-100000@bits.bris.ac.uk> <Pine.LNX.4.21.0104232051040.7619-100000@bits.bris.ac.uk>
In-Reply-To: <Pine.LNX.4.21.0104232051040.7619-100000@bits.bris.ac.uk>; from madmatt@bits.bris.ac.uk on Mon, Apr 23, 2001 at 08:58:54PM +0100
On Mon, Apr 23, 2001 at 08:58:54PM +0100, Matt wrote:
> 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 );
> ^^^^^^^^^^^
> 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).
Yes, that works (with the obvious note on checking argument sizes
and not kmallocing too much memory).
All "read" functions do the same. As you were clever enough to
copy the pointer itself into kernel space, too (which many driver
writes forget!), you have done the right thing here.
Congratulations! ;-)
Regards
Ingo Oeser
--
10.+11.03.2001 - 3. Chemnitzer LinuxTag <http://www.tu-chemnitz.de/linux/tag>
<<<<<<<<<<<< been there and had much fun >>>>>>>>>>>>
next prev parent reply other threads:[~2001-04-23 21:33 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-04-23 16:06 Matt
2001-04-23 17:50 ` Ingo Oeser
2001-04-23 20:14 ` Matt
2001-04-23 20:17 ` rui.sousa
2001-04-23 20:34 ` Matt
2001-04-23 20:37 ` Mathieu Chouquet-Stringer
2001-04-23 21:11 ` [OFFTOPIC] " rui.sousa
2001-04-23 19:58 ` Matt
2001-04-23 21:33 ` Ingo Oeser [this message]
2001-04-23 22:09 ` Matt
2001-04-23 23:41 ` Jonathan Lundell
2001-04-23 18:29 Petr Vandrovec
2001-04-23 16:40 ` Alex Bligh - linux-kernel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20010423233312.Y682@nightmaster.csn.tu-chemnitz.de \
--to=ingo.oeser@informatik.tu-chemnitz.de \
--cc=linux-kernel@vger.kernel.org \
--cc=madmatt@bits.bris.ac.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®