Re: Restoring joydev BTNMAP ioctl compatibility

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Aug 11, 2009 at 08:20:32AM +0200, Stephen Kitt wrote:
> Hi Dmitry,
> 
> On Mon, 10 Aug 2009 13:27:26 -0700, Dmitry Torokhov
> <dmitry.torokhov@xxxxxxxxx> wrote:
> > Actually I think we need to return "len" here to let userspace know how
> > much data we produced. Also, could you please give the same treatment to
> > JSIOCGAXMAP and JSIOCSAXMAP and I will apply it.
> 
> Here goes! I'm not too familiar with kernel memory handling, I'll send the
> fixes for the FIXMEs later on as a separate patch once I've figured things
> out; I'm thinking along these lines:
> * vmalloc() a buffer
> * return -ENOMEM if no memory is available
> * copy_from_user the data into the temporary buffer
> * validate the data
> * on error vfree() the buffer and return -EINVAL
> * copy the data from the temporary buffer to the destination array
> * vfree() the buffer
> 

Yep, exactly, except that don't bother with vmalloc, kmalloc will do
nicely since the amout of memory needed is relatively small.

-- 
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux