lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Sun, 19 Mar 2023 20:43:32 +0100
From:   Pali Rohár <pali@...nel.org>
To:     "Jason A. Donenfeld" <Jason@...c4.com>
Cc:     msizanoen <msizanoen@...labs.xyz>,
        Dmitry Torokhov <dmitry.torokhov@...il.com>,
        Hans de Goede <hdegoede@...hat.com>, stable@...r.kernel.org,
        linux-input@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] input: alps: fix compatibility with -funsigned-char

On Sunday 19 March 2023 18:45:08 Jason A. Donenfeld wrote:
> Might be wise to clean up a few other ones in that file? Or not. Up to
> you:
> 
> diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c
> index 989228b5a0a4..afbf67c2488a 100644
> --- a/drivers/input/mouse/alps.c
> +++ b/drivers/input/mouse/alps.c
> @@ -852,8 +852,8 @@ static void alps_process_packet_v6(struct psmouse *psmouse)
>  			x = y = z = 0;
> 
>  		/* Divide 4 since trackpoint's speed is too fast */
> -		input_report_rel(dev2, REL_X, (char)x / 4);
> -		input_report_rel(dev2, REL_Y, -((char)y / 4));
> +		input_report_rel(dev2, REL_X, (signed char)x / 4);
> +		input_report_rel(dev2, REL_Y, -((signed char)y / 4));

Anyway, is casting here needed at all? Is not just plain -(y / 4) enough?

> 
>  		psmouse_report_standard_buttons(dev2, packet[3]);
> 
> @@ -1104,8 +1104,8 @@ static void alps_process_trackstick_packet_v7(struct psmouse *psmouse)
>  	    ((packet[3] & 0x20) << 1);
>  	z = (packet[5] & 0x3f) | ((packet[3] & 0x80) >> 1);
> 
> -	input_report_rel(dev2, REL_X, (char)x);
> -	input_report_rel(dev2, REL_Y, -((char)y));
> +	input_report_rel(dev2, REL_X, (signed char)x);
> +	input_report_rel(dev2, REL_Y, -((signed char)y));
>  	input_report_abs(dev2, ABS_PRESSURE, z);
> 
>  	psmouse_report_standard_buttons(dev2, packet[1]);
> diff --git a/drivers/input/mouse/elan_i2c_core.c b/drivers/input/mouse/elan_i2c_core.c
> index 5f0d75a45c80..43a1116c5852 100644
> --- a/drivers/input/mouse/elan_i2c_core.c
> +++ b/drivers/input/mouse/elan_i2c_core.c
> @@ -382,7 +382,7 @@ static unsigned int elan_convert_resolution(u8 val, u8 pattern)
>  	 *	((value from firmware) + 3) * 100 = dpi
>  	 */
>  	int res = pattern <= 0x01 ?
> -		(int)(char)val * 10 + 790 : ((int)(char)val + 3) * 100;
> +		(int)(signed char)val * 10 + 790 : ((int)(signed char)val + 3) * 100;
>  	/*
>  	 * We also have to convert dpi to dots/mm (*10/254 to avoid floating
>  	 * point).

Please move elantech change into separate commit/patch. As it has
nothing with alps driver. It is completely different hardware.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ