linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Cc: David Herrmann <dh.herrmann@gmail.com>,
	Peter Hutterer <peter.hutterer@who-t.net>,
	linux-input@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3] Input: uinput - add new UINPUT_DEV_SETUP and UI_ABS_SETUP ioctl
Date: Sat, 24 Oct 2015 15:53:41 -0700	[thread overview]
Message-ID: <20151024225341.GA17120@dtor-pixel> (raw)
In-Reply-To: <1440515579-5359-1-git-send-email-benjamin.tissoires@redhat.com>

Hi Benjamin,

On Tue, Aug 25, 2015 at 11:12:59AM -0400, Benjamin Tissoires wrote:
> +static int uinput_abs_setup(struct uinput_device *udev,
> +			    struct uinput_setup __user *arg, size_t size)
> +{
> +	struct uinput_abs_setup setup = {};
> +	struct input_dev *dev;
> +
> +	if (size > sizeof(setup))
> +		return -E2BIG;
> +	if (udev->state == UIST_CREATED)
> +		return -EINVAL;
> +	if (copy_from_user(&setup, arg, size))
> +		return -EFAULT;
> +	if (setup.code > ABS_MAX)
> +		return -ERANGE;
> +
> +	dev = udev->dev;
> +
> +	input_alloc_absinfo(dev);
> +	if (!dev->absinfo)
> +		return -ENOMEM;
> +
> +	set_bit(setup.code, dev->absbit);
> +	dev->absinfo[setup.code] = setup.absinfo;
> +
> +	/*
> +	 * We restore the state to UIST_NEW_DEVICE because the user has to call
> +	 * UI_DEV_SETUP in the last place before UI_DEV_CREATE to check the
> +	 * validity of the absbits.
> +	 */

Do we have to be this strict? It seems to me that with the new IOCTLs
you naturally want to use the new ioctl to setup the device, then adjust
various axes and bits and then validate everything.

Thanks.

-- 
Dmitry

  parent reply	other threads:[~2015-10-25  3:08 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-25 15:12 [PATCH v3] Input: uinput - add new UINPUT_DEV_SETUP and UI_ABS_SETUP ioctl Benjamin Tissoires
2015-09-21 10:45 ` David Herrmann
2015-10-19 20:39   ` Benjamin Tissoires
2015-10-24 22:53 ` Dmitry Torokhov [this message]
2015-10-25  9:39   ` David Herrmann
2015-10-28 15:10     ` Benjamin Tissoires
2015-12-19  1:50       ` Dmitry Torokhov
2015-11-08 10:55 ` Elias Vanderstuyft
2015-11-09  7:50   ` Benjamin Tissoires
2015-11-10 21:42     ` Elias Vanderstuyft

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=20151024225341.GA17120@dtor-pixel \
    --to=dmitry.torokhov@gmail.com \
    --cc=benjamin.tissoires@redhat.com \
    --cc=dh.herrmann@gmail.com \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peter.hutterer@who-t.net \
    /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;
as well as URLs for NNTP newsgroup(s).