From: Peter Hutterer <peter.hutterer@who-t.net>
To: Chris Morgan <macroalpha82@gmail.com>
Cc: linux-input@vger.kernel.org, dmitry.torokhov@gmail.com,
svv@google.com, biswarupp@google.com, paul@crapouillou.net,
contact@artur-rojek.eu, Chris Morgan <macromorgan@hotmail.com>
Subject: Re: [PATCH] input: uinput: Drop checks for abs_min > abs_max
Date: Wed, 20 Dec 2023 09:51:49 +1000 [thread overview]
Message-ID: <20231219235149.GA3401344@quokka> (raw)
In-Reply-To: <20231218171653.141941-1-macroalpha82@gmail.com>
On Mon, Dec 18, 2023 at 11:16:53AM -0600, Chris Morgan wrote:
> From: Chris Morgan <macromorgan@hotmail.com>
>
> Stop checking if the minimum abs value is greater than the maximum abs
> value. When the axis is inverted this condition is allowed. Without
> relaxing this check, it is not possible to use uinput on devices in
> userspace with an inverted axis, such as the adc-joystick found on
> many handheld gaming devices.
As mentioned in the other thread [1] a fair bit of userspace relies on
that general assumption so removing it will likely cause all sorts of
issues.
Cheers,
Petre
[1] https://lore.kernel.org/linux-input/20231219234803.GA3396969@quokka/T/#t
>
> Signed-off-by: Chris Morgan <macromorgan@hotmail.com>
> ---
> drivers/input/misc/uinput.c | 9 +--------
> 1 file changed, 1 insertion(+), 8 deletions(-)
>
> diff --git a/drivers/input/misc/uinput.c b/drivers/input/misc/uinput.c
> index d98212d55108..e90dbf2c0b34 100644
> --- a/drivers/input/misc/uinput.c
> +++ b/drivers/input/misc/uinput.c
> @@ -403,14 +403,7 @@ static int uinput_validate_absinfo(struct input_dev *dev, unsigned int code,
> min = abs->minimum;
> max = abs->maximum;
>
> - if ((min != 0 || max != 0) && max < min) {
> - printk(KERN_DEBUG
> - "%s: invalid abs[%02x] min:%d max:%d\n",
> - UINPUT_NAME, code, min, max);
> - return -EINVAL;
> - }
> -
> - if (!check_sub_overflow(max, min, &range) && abs->flat > range) {
> + if (!check_sub_overflow(max, min, &range) && abs->flat > abs(range)) {
> printk(KERN_DEBUG
> "%s: abs_flat #%02x out of range: %d (min:%d/max:%d)\n",
> UINPUT_NAME, code, abs->flat, min, max);
> --
> 2.34.1
>
>
next prev parent reply other threads:[~2023-12-19 23:51 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-18 17:16 [PATCH] input: uinput: Drop checks for abs_min > abs_max Chris Morgan
2023-12-19 23:51 ` Peter Hutterer [this message]
2023-12-20 0:38 ` Paul Cercueil
2023-12-20 1:53 ` Dmitry Torokhov
2023-12-20 13:39 ` Paul Cercueil
2023-12-22 17:09 ` Chris Morgan
2024-01-03 23:22 ` Peter Hutterer
2023-12-23 14:29 ` Hans de Goede
2023-12-23 15:01 ` Paul Cercueil
2023-12-23 15:16 ` Hans de Goede
2023-12-24 8:03 ` Dmitry Torokhov
2023-12-30 5:32 ` Chris Morgan
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=20231219235149.GA3401344@quokka \
--to=peter.hutterer@who-t.net \
--cc=biswarupp@google.com \
--cc=contact@artur-rojek.eu \
--cc=dmitry.torokhov@gmail.com \
--cc=linux-input@vger.kernel.org \
--cc=macroalpha82@gmail.com \
--cc=macromorgan@hotmail.com \
--cc=paul@crapouillou.net \
--cc=svv@google.com \
/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