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]
Message-ID: <20241031123113.18843-2-charles.goodix@gmail.com>
Date: Thu, 31 Oct 2024 20:31:12 +0800
From: Charles Wang <charles.goodix@...il.com>
To: dmitry.torokhov@...il.com,
	hbarnor@...omium.org
Cc: jikos@...nel.org,
	bentiss@...nel.org,
	dianders@...omium.org,
	dan.carpenter@...aro.org,
	linux-input@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	Charles Wang <charles.goodix@...il.com>
Subject: [PATCH v2 1/2] HID: hid-goodix: Return 0 when receiving an empty HID feature package

Align with the i2c-hid driver by returning 0 instead of -EINVAL when
an empty response is received, ensuring that userspace programs utilizing
the hidraw node receive consistent return values.

Signed-off-by: Charles Wang <charles.goodix@...il.com>
---
 drivers/hid/hid-goodix-spi.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/hid/hid-goodix-spi.c b/drivers/hid/hid-goodix-spi.c
index 0f87bf9c6..077a91ee1 100644
--- a/drivers/hid/hid-goodix-spi.c
+++ b/drivers/hid/hid-goodix-spi.c
@@ -356,7 +356,7 @@ static int goodix_hid_check_ack_status(struct goodix_ts_data *ts, u32 *resp_len)
 				dev_err(ts->dev, "hrd.size too short: %d", len);
 				return -EINVAL;
 			}
-			*resp_len = len;
+			*resp_len = len - GOODIX_HID_PKG_LEN_SIZE;
 			return 0;
 		}
 
@@ -446,7 +446,10 @@ static int goodix_hid_get_raw_report(struct hid_device *hid,
 	if (error)
 		return error;
 
-	len = min(len, response_data_len - GOODIX_HID_PKG_LEN_SIZE);
+	/* Empty reprot response */
+	if (!response_data_len)
+		return 0;
+	len = min(len, response_data_len);
 	/* Step3: read response data(skip 2bytes of hid pkg length) */
 	error = goodix_spi_read(ts, ts->hid_report_addr +
 				GOODIX_HID_ACK_HEADER_SIZE +
-- 
2.43.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ