Re: [PATCH] input: uinput: Drop checks for abs_min > abs_max

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

 



On Mon, Dec 18, 2023 at 11:16:53AM -0600, Chris Morgan wrote:
> From: Chris Morgan <macromorgan@xxxxxxxxxxx>
> 
> 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@xxxxxxxxxxx>
> ---
>  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
> 
> 




[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