[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <49d10207-6f31-f1a1-90f1-7f8df5a83ee2@redhat.com>
Date: Sat, 18 Mar 2023 17:43:06 +0100
From: Hans de Goede <hdegoede@...hat.com>
To: "Jason A. Donenfeld" <Jason@...c4.com>, dmitry.torokhov@...il.com,
linux-input@...r.kernel.org, linux-kernel@...r.kernel.org,
regressions@...ts.linux.dev
Cc: stable@...r.kernel.org, regressions@...mhuis.info,
barry@...sagefor.me.uk
Subject: Re: [PATCH] Input: focaltech - use explicitly signed char type
Hi,
On 3/18/23 14:30, Jason A. Donenfeld wrote:
> The recent change of -funsigned-char causes additions of negative
> numbers to become additions of large positive numbers, leading to wrong
> calculations of mouse movement. Change these casts to be explictly
> signed, to take into account negative offsets.
>
> Fixes: 3bc753c06dd0 ("kbuild: treat char as always unsigned")
> Cc: stable@...r.kernel.org
> Cc: regressions@...mhuis.info
> Cc: barry@...sagefor.me.uk
> Signed-off-by: Jason A. Donenfeld <Jason@...c4.com>
> ---
> Wrote this patch from my phone, untested, so it would be nice if
> somebody with hardware could confirm it works.
Thanks, patch looks good to me:
Reviewed-by: Hans de Goede <hdegoede@...hat.com>
Regards,
Hans
>
> drivers/input/mouse/focaltech.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/input/mouse/focaltech.c b/drivers/input/mouse/focaltech.c
> index 6fd5fff0cbff..3dbad0d8e8c9 100644
> --- a/drivers/input/mouse/focaltech.c
> +++ b/drivers/input/mouse/focaltech.c
> @@ -202,8 +202,8 @@ static void focaltech_process_rel_packet(struct psmouse *psmouse,
> state->pressed = packet[0] >> 7;
> finger1 = ((packet[0] >> 4) & 0x7) - 1;
> if (finger1 < FOC_MAX_FINGERS) {
> - state->fingers[finger1].x += (char)packet[1];
> - state->fingers[finger1].y += (char)packet[2];
> + state->fingers[finger1].x += (signed char)packet[1];
> + state->fingers[finger1].y += (signed char)packet[2];
> } else {
> psmouse_err(psmouse, "First finger in rel packet invalid: %d\n",
> finger1);
> @@ -218,8 +218,8 @@ static void focaltech_process_rel_packet(struct psmouse *psmouse,
> */
> finger2 = ((packet[3] >> 4) & 0x7) - 1;
> if (finger2 < FOC_MAX_FINGERS) {
> - state->fingers[finger2].x += (char)packet[4];
> - state->fingers[finger2].y += (char)packet[5];
> + state->fingers[finger2].x += (signed char)packet[4];
> + state->fingers[finger2].y += (signed char)packet[5];
> }
> }
>
Powered by blists - more mailing lists