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: <1291571382-2719-21-git-send-email-adobriyan@gmail.com>
Date:	Sun,  5 Dec 2010 19:49:18 +0200
From:	Alexey Dobriyan <adobriyan@...il.com>
To:	akpm@...ux-foundation.org
Cc:	linux-kernel@...r.kernel.org, Alexey Dobriyan <adobriyan@...il.com>
Subject: [PATCH 21/45] kstrtox: convert drivers/hid/


Signed-off-by: Alexey Dobriyan <adobriyan@...il.com>
---
 drivers/hid/hid-magicmouse.c  |   14 ++++++++--
 drivers/hid/hid-ntrig.c       |   54 ++++++++++++++++++++++------------------
 drivers/hid/hid-roccat-kone.c |    8 +++---
 3 files changed, 45 insertions(+), 31 deletions(-)

diff --git a/drivers/hid/hid-magicmouse.c b/drivers/hid/hid-magicmouse.c
index e6dc151..5107ee5 100644
--- a/drivers/hid/hid-magicmouse.c
+++ b/drivers/hid/hid-magicmouse.c
@@ -32,9 +32,17 @@ module_param(emulate_scroll_wheel, bool, 0644);
 MODULE_PARM_DESC(emulate_scroll_wheel, "Emulate a scroll wheel");
 
 static unsigned int scroll_speed = 32;
-static int param_set_scroll_speed(const char *val, struct kernel_param *kp) {
-	unsigned long speed;
-	if (!val || strict_strtoul(val, 0, &speed) || speed > 63)
+static int param_set_scroll_speed(const char *val, struct kernel_param *kp)
+{
+	unsigned int speed;
+	int rv;
+
+	if (!val)
+		return -EINVAL;
+	rv = kstrtouint(val, 0, &speed);
+	if (rv < 0)
+		return rv;
+	if (speed > 63)
 		return -EINVAL;
 	scroll_speed = speed;
 	return 0;
diff --git a/drivers/hid/hid-ntrig.c b/drivers/hid/hid-ntrig.c
index 69169ef..6128531 100644
--- a/drivers/hid/hid-ntrig.c
+++ b/drivers/hid/hid-ntrig.c
@@ -206,11 +206,12 @@ static ssize_t set_min_width(struct device *dev,
 	struct hid_device *hdev = container_of(dev, struct hid_device, dev);
 	struct ntrig_data *nd = hid_get_drvdata(hdev);
 
-	unsigned long val;
-
-	if (strict_strtoul(buf, 0, &val))
-		return -EINVAL;
+	u16 val;
+	int rv;
 
+	rv = kstrtou16(buf, 0, &val);
+	if (rv < 0)
+		return rv;
 	if (val > nd->sensor_physical_width)
 		return -EINVAL;
 
@@ -241,11 +242,12 @@ static ssize_t set_min_height(struct device *dev,
 	struct hid_device *hdev = container_of(dev, struct hid_device, dev);
 	struct ntrig_data *nd = hid_get_drvdata(hdev);
 
-	unsigned long val;
-
-	if (strict_strtoul(buf, 0, &val))
-		return -EINVAL;
+	u16 val;
+	int rv;
 
+	rv = kstrtou16(buf, 0, &val);
+	if (rv < 0)
+		return rv;
 	if (val > nd->sensor_physical_height)
 		return -EINVAL;
 
@@ -275,11 +277,12 @@ static ssize_t set_activate_slack(struct device *dev,
 	struct hid_device *hdev = container_of(dev, struct hid_device, dev);
 	struct ntrig_data *nd = hid_get_drvdata(hdev);
 
-	unsigned long val;
-
-	if (strict_strtoul(buf, 0, &val))
-		return -EINVAL;
+	u8 val;
+	int rv;
 
+	rv = kstrtou8(buf, 0, &val);
+	if (rv < 0)
+		return rv;
 	if (val > 0x7f)
 		return -EINVAL;
 
@@ -310,11 +313,12 @@ static ssize_t set_activation_width(struct device *dev,
 	struct hid_device *hdev = container_of(dev, struct hid_device, dev);
 	struct ntrig_data *nd = hid_get_drvdata(hdev);
 
-	unsigned long val;
-
-	if (strict_strtoul(buf, 0, &val))
-		return -EINVAL;
+	u16 val;
+	int rv;
 
+	rv = kstrtou16(buf, 0, &val);
+	if (rv < 0)
+		return rv;
 	if (val > nd->sensor_physical_width)
 		return -EINVAL;
 
@@ -346,11 +350,12 @@ static ssize_t set_activation_height(struct device *dev,
 	struct hid_device *hdev = container_of(dev, struct hid_device, dev);
 	struct ntrig_data *nd = hid_get_drvdata(hdev);
 
-	unsigned long val;
-
-	if (strict_strtoul(buf, 0, &val))
-		return -EINVAL;
+	u16 val;
+	int rv;
 
+	rv = kstrtou16(buf, 0, &val);
+	if (rv < 0)
+		return rv;
 	if (val > nd->sensor_physical_height)
 		return -EINVAL;
 
@@ -380,11 +385,12 @@ static ssize_t set_deactivate_slack(struct device *dev,
 	struct hid_device *hdev = container_of(dev, struct hid_device, dev);
 	struct ntrig_data *nd = hid_get_drvdata(hdev);
 
-	unsigned long val;
-
-	if (strict_strtoul(buf, 0, &val))
-		return -EINVAL;
+	u8 val;
+	int rv;
 
+	rv = kstrtou8(buf, 0, &val);
+	if (rv < 0)
+		return rv;
 	/*
 	 * No more than 8 terminal frames have been observed so far
 	 * and higher slack is highly likely to leave the single
diff --git a/drivers/hid/hid-roccat-kone.c b/drivers/hid/hid-roccat-kone.c
index f776957..e0dd8f9 100644
--- a/drivers/hid/hid-roccat-kone.c
+++ b/drivers/hid/hid-roccat-kone.c
@@ -507,9 +507,9 @@ static ssize_t kone_sysfs_set_tcu(struct device *dev,
 	struct kone_device *kone = hid_get_drvdata(dev_get_drvdata(dev));
 	struct usb_device *usb_dev = interface_to_usbdev(to_usb_interface(dev));
 	int retval;
-	unsigned long state;
+	int state;
 
-	retval = strict_strtoul(buf, 10, &state);
+	retval = kstrtoint(buf, 10, &state);
 	if (retval)
 		return retval;
 
@@ -589,9 +589,9 @@ static ssize_t kone_sysfs_set_startup_profile(struct device *dev,
 	struct kone_device *kone = hid_get_drvdata(dev_get_drvdata(dev));
 	struct usb_device *usb_dev = interface_to_usbdev(to_usb_interface(dev));
 	int retval;
-	unsigned long new_startup_profile;
+	int new_startup_profile;
 
-	retval = strict_strtoul(buf, 10, &new_startup_profile);
+	retval = kstrtoint(buf, 10, &new_startup_profile);
 	if (retval)
 		return retval;
 
-- 
1.7.2.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ