From: Christoph Hellwig <hch@infradead.org>
To: Michael Hunold <hunold@convergence.de>
Cc: Christoph Hellwig <hch@infradead.org>,
linux-kernel@vger.kernel.org, Gerd Knorr <kraxel@bytesex.org>,
Alan Cox <alan@lxorguk.ukuu.org.uk>
Subject: Re: [RFC][2.5] generic_usercopy() function (resend, forgot the patches)
Date: Fri, 23 May 2003 11:19:41 +0100 [thread overview]
Message-ID: <20030523111941.A19033@infradead.org> (raw)
In-Reply-To: <3ECDF3B1.8090902@convergence.de>; from hunold@convergence.de on Fri, May 23, 2003 at 12:10:57PM +0200
On Fri, May 23, 2003 at 12:10:57PM +0200, Michael Hunold wrote:
> > Also file/inode should go away from the prototype (and the callback).
> > Only file is needed because inode == file->f_dentry->d_inode, and even
> > that one should be just some void *data instead.
>
> I only copied the function from videodev.c and renamed it, so please
> don't blame me for the way stuff is done there. 8-)
>
> Perhaps Gerd Knorr or Alan Cox can comment on your changes -- I'll have
> to investigate if all of these arguments are used anyway.
I don't blame you. I just think it shouldn't be added to the kernel API
without fixing it first :)
>
> >>+ case _IOC_READ: /* some v4l ioctls are marked wrong ... */
> > That's crap. Please move this workaround to v4l not into generic code.
>
> Is it possible to fix the definitons of the v4l ioctls instead without
> breaking binary compatiblity?
I doubt it. This just means v4l has to work around it's bug in the
v4l code, not in common code.
> >>+ case _IOC_WRITE:
> >>+ case (_IOC_WRITE | _IOC_READ):
> >>+ if (_IOC_SIZE(cmd) <= sizeof(sbuf)) {
> >>+ parg = sbuf;
> >>+ } else {
> >>+ /* too big to allocate from stack */
> >>+ mbuf = kmalloc(_IOC_SIZE(cmd),GFP_KERNEL);
> >>+ if (NULL == mbuf)
> >>+ return -ENOMEM;
> >>+ parg = mbuf;
> >
> >
> > I wonder whether you should just kmalloc always.
>
> Since this function is always used in user context and the memory is
> always freed afterwards, it should be possible to use vmalloc() or a
> static buffer (what's the maximum size?) instead.
Sorry, I meant it's probably not worth using the stack at all.
vmalloc() for ioctl buffers sounds like a very bad idea.
next prev parent reply other threads:[~2003-05-23 10:07 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-05-23 9:37 Michael Hunold
2003-05-23 9:47 ` Christoph Hellwig
2003-05-23 10:10 ` Michael Hunold
2003-05-23 10:19 ` Christoph Hellwig [this message]
2003-05-23 11:49 ` Gerd Knorr
2003-05-25 11:23 ` David Woodhouse
2003-05-23 11:17 ` Ingo Oeser
2003-05-30 0:25 ` David Wagner
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=20030523111941.A19033@infradead.org \
--to=hch@infradead.org \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=hunold@convergence.de \
--cc=kraxel@bytesex.org \
--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®