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,  8 May 2022 18:01:43 +0200
From:   José Expósito <jose.exposito89@...il.com>
To:     jikos@...nel.org
Cc:     benjamin.tissoires@...hat.com, spbnick@...il.com,
        linux-input@...r.kernel.org, linux-kernel@...r.kernel.org,
        stefanberzl@...il.com, albertofanjul@...il.com,
        José Expósito <jose.exposito89@...il.com>
Subject: [PATCH for-5.19/uclogic 4/7] HID: uclogic: Always shift touch reports to zero

From: Nikolai Kondrashov <spbnick@...il.com>

Always decrement touch report values to have the range start with zero,
regardless if flipped or not. This fixes the future non-flipped touch
strip reports.

Signed-off-by: Nikolai Kondrashov <spbnick@...il.com>
Signed-off-by: José Expósito <jose.exposito89@...il.com>
---
 drivers/hid/hid-uclogic-core.c   | 15 ++++++++-------
 drivers/hid/hid-uclogic-params.c |  2 +-
 2 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/drivers/hid/hid-uclogic-core.c b/drivers/hid/hid-uclogic-core.c
index cc53625ed1f7..c4ab94d58a0f 100644
--- a/drivers/hid/hid-uclogic-core.c
+++ b/drivers/hid/hid-uclogic-core.c
@@ -386,15 +386,16 @@ static int uclogic_raw_event_frame(
 	}
 
 	/* If need to, and can, transform the touch ring reports */
-	if (frame->touch_byte > 0 && frame->touch_byte < size &&
-	    frame->touch_flip_at != 0) {
+	if (frame->touch_byte > 0 && frame->touch_byte < size) {
 		__s8 value = data[frame->touch_byte];
-		if (value != 0) {
-			value = frame->touch_flip_at - value;
-			if (value < 0)
-				value = frame->touch_max + value;
 
-			data[frame->touch_byte] = value;
+		if (value != 0) {
+			if (frame->touch_flip_at != 0) {
+				value = frame->touch_flip_at - value;
+				if (value <= 0)
+					value = frame->touch_max + value;
+			}
+			data[frame->touch_byte] = value - 1;
 		}
 	}
 
diff --git a/drivers/hid/hid-uclogic-params.c b/drivers/hid/hid-uclogic-params.c
index 459f15288ccc..163efd026881 100644
--- a/drivers/hid/hid-uclogic-params.c
+++ b/drivers/hid/hid-uclogic-params.c
@@ -889,7 +889,7 @@ static int uclogic_params_huion_init(struct uclogic_params *params,
 				UCLOGIC_RDESC_V2_FRAME_TOUCH_DEV_ID_BYTE;
 			p.frame_list[1].touch_byte = 5;
 			p.frame_list[1].touch_max = 12;
-			p.frame_list[1].touch_flip_at = 6;
+			p.frame_list[1].touch_flip_at = 7;
 
 			/* Create v2 frame dial parameters */
 			rc = uclogic_params_frame_init_with_desc(
-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ