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 for Android: free password hash cracker in your pocket
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240731093310.3696919-1-jkeeping@inmusicbrands.com>
Date: Wed, 31 Jul 2024 10:33:09 +0100
From: John Keeping <jkeeping@...usicbrands.com>
To: Dmitry Torokhov <dmitry.torokhov@...il.com>
Cc: John Keeping <jkeeping@...usicbrands.com>,
	Artur Rojek <contact@...ur-rojek.eu>,
	Chris Morgan <macromorgan@...mail.com>,
	Javier Carrasco <javier.carrasco.cruz@...il.com>,
	linux-input@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: [PATCH] Input: adc-joystick - fix optional value handling

The abs-fuzz and abs-flat properties are documented as optional.  When
these are absent, fwnode_property_read_u32() will leave the input
unchanged, meaning that an axis either picks up the value for the
previous axis or an uninitialized value.

Explicitly set these values to zero when they are unspecified to match
the documented behaviour in the device tree bindings.

Signed-off-by: John Keeping <jkeeping@...usicbrands.com>
---
 drivers/input/joystick/adc-joystick.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/input/joystick/adc-joystick.c b/drivers/input/joystick/adc-joystick.c
index 130245be884bc..02713e624df1c 100644
--- a/drivers/input/joystick/adc-joystick.c
+++ b/drivers/input/joystick/adc-joystick.c
@@ -180,8 +180,11 @@ static int adc_joystick_set_axes(struct device *dev, struct adc_joystick *joy)
 			swap(range[0], range[1]);
 		}
 
-		fwnode_property_read_u32(child, "abs-fuzz", &fuzz);
-		fwnode_property_read_u32(child, "abs-flat", &flat);
+		if (fwnode_property_read_u32(child, "abs-fuzz", &fuzz))
+			fuzz = 0;
+
+		if (fwnode_property_read_u32(child, "abs-flat", &flat))
+			flat = 0;
 
 		input_set_abs_params(joy->input, axes[i].code,
 				     range[0], range[1], fuzz, flat);
-- 
2.45.2


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ