From: Bill Nottingham <notting@redhat.com>
To: linux-kernel@vger.kernel.org
Subject: random ioctls - are they supposed to be like this?
Date: Wed, 18 Aug 2004 16:42:13 -0400 [thread overview]
Message-ID: <20040818204213.GA19909@nostromo.devel.redhat.com> (raw)
include/linux/random.h has:
#define RNDADDENTROPY _IOW( 'R', 0x03, int [2] )
#define RNDGETPOOL _IOR( 'R', 0x02, int [2] )
However, these seem to be used differently in practice.
For example, the one user of RNDADDENTROPY I find does:
struct {
int ent_count;
int size;
unsigned char data[size];
} entropy;
if (ioctl(fd, RNDADDENTROPY, &entropy) != 0) {
...
And, looking at the random driver, it does appear to expect
this format.
Now, RNDGETPOOL in the kernel does:
if (get_user(size, p) ||
put_user(random_state->poolinfo.poolwords, p++))
return -EFAULT;
...
if (!copy_to_user(p, tmp, size * sizeof(__u32))) {
...
if(put_user(ent_count, p++))
return -EFAULT;
Which obviously isn't going to work right if you
just pass in a two-int structure.
Am I reading this wrong, or are callers just supposed
to know to use the other interface?
Bill
reply other threads:[~2004-08-18 20:43 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20040818204213.GA19909@nostromo.devel.redhat.com \
--to=notting@redhat.com \
--cc=linux-kernel@vger.kernel.org \
/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®