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:   Tue, 28 Feb 2017 14:46:25 -0800
From:   Dmitry Torokhov <dmitry.torokhov@...il.com>
To:     Daniel Mack <daniel@...que.org>
Cc:     Haojian Zhuang <haojian.zhuang@...il.com>,
        Robert Jarzmik <robert.jarzmik@...e.fr>,
        linux-kernel@...r.kernel.org, linux-input@...r.kernel.org
Subject: [PATCH 03/10] Input: eeti_ts - use get_unaligned_be16() to retrieve data

Instead of manually converting big endian data on wire into host
endianness, let's use helpers to do that for us. It might save us
a few cycles if host endianness matches what's on wire.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@...il.com>
---
 drivers/input/touchscreen/eeti_ts.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/input/touchscreen/eeti_ts.c b/drivers/input/touchscreen/eeti_ts.c
index 26b52496748a..0e4b19236d68 100644
--- a/drivers/input/touchscreen/eeti_ts.c
+++ b/drivers/input/touchscreen/eeti_ts.c
@@ -34,6 +34,7 @@
 #include <linux/gpio.h>
 #include <linux/input/eeti_ts.h>
 #include <linux/slab.h>
+#include <asm/unaligned.h>
 
 static bool flip_x;
 module_param(flip_x, bool, 0644);
@@ -89,8 +90,9 @@ static void eeti_ts_read(struct work_struct *work)
 
 	pressed = buf[0] & REPORT_BIT_PRESSED;
 	res = REPORT_RES_BITS(buf[0] & (REPORT_BIT_AD0 | REPORT_BIT_AD1));
-	x = buf[2] | (buf[1] << 8);
-	y = buf[4] | (buf[3] << 8);
+
+	x = get_unaligned_be16(&buf[1]);
+	y = get_unaligned_be16(&buf[3]);
 
 	/* fix the range to 11 bits */
 	x >>= res - EETI_TS_BITDEPTH;
-- 
2.11.0.483.g087da7b7c-goog

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ