All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Hutterer <peter.hutterer@who-t.net>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Anshul Garg <aksgarg1989@gmail.com>,
	linux-input@vger.kernel.org, anshul.g@samsung.com,
	Benjamin Tissoires <benjamin.tissoires@gmail.com>,
	Hans de Goede <hdegoede@redhat.com>,
	Jiri Kosina <jkosina@suse.cz>
Subject: Re: [PATCH] Input :Added Check for EV_ABS event params
Date: Wed, 22 Apr 2015 07:56:00 +1000	[thread overview]
Message-ID: <20150421215600.GA22958@jelly.redhat.com> (raw)
In-Reply-To: <20150421182916.GB16790@dtor-ws>

On Tue, Apr 21, 2015 at 11:29:16AM -0700, Dmitry Torokhov wrote:
> Hi Anshul,
> 
> On Tue, Apr 21, 2015 at 11:19:52AM -0700, Anshul Garg wrote:
> > From: Anshul Garg <aksgarg1989@gmail.com>
> > 
> > while handling EV_ABS event in input_handle_abs_event
> > function added check for out of range event value from
> > input driver. As input driver sets the ABS params at
> > registration time so input core should ignore events out
> > of the range set by the input driver.
> 
> No, I do not think we want to do that, at least not unconditionally,
> especially since it is perfectly allowed to use 0 as min/max, which
> means that exact min and max are not defined. Historically min and max
> were provided to the userspace as a guidance and it was up to userspace
> to decide what to do with values outside of the limits.

for the archives:
X requires us to drop coordinates outside the given range, at least the 
ones we forward to the clients from absolute devices. We have used
out-of-bounds variables within the synaptics driver in the past though.

Cheers,
   Peter

> > 
> > Signed-off-by: Anshul Garg <aksgarg1989@gmail.com>
> > ---
> >  drivers/input/input.c |    5 +++++
> >  1 file changed, 5 insertions(+)
> > 
> > diff --git a/drivers/input/input.c b/drivers/input/input.c
> > index cc357f1..b1a6ff6 100644
> > --- a/drivers/input/input.c
> > +++ b/drivers/input/input.c
> > @@ -244,6 +244,11 @@ static int input_handle_abs_event(struct input_dev *dev,
> >  		pold = NULL;
> >  	}
> >  
> > +	if (dev->absinfo[code].minimum > *pval || dev->absinfo[code].maximum < *pval) {
> > +		/* Ignore event with out of range values */		
> > +		return INPUT_IGNORE_EVENT;
> > +	}
> > +
> >  	if (pold) {
> >  		*pval = input_defuzz_abs_event(*pval, *pold,
> >  						dev->absinfo[code].fuzz);
> > -- 
> > 1.7.9.5
> > 

  reply	other threads:[~2015-04-21 23:36 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-21 18:19 [PATCH] Input :Added Check for EV_ABS event params Anshul Garg
2015-04-21 18:29 ` Dmitry Torokhov
2015-04-21 21:56   ` Peter Hutterer [this message]
2015-04-22  6:35     ` Hans de Goede
2015-04-22 13:44   ` Anshul Garg
2015-04-22 13:57     ` Benjamin Tissoires

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=20150421215600.GA22958@jelly.redhat.com \
    --to=peter.hutterer@who-t.net \
    --cc=aksgarg1989@gmail.com \
    --cc=anshul.g@samsung.com \
    --cc=benjamin.tissoires@gmail.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=hdegoede@redhat.com \
    --cc=jkosina@suse.cz \
    --cc=linux-input@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.