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:	Sat,  5 Feb 2011 16:20:13 +0200
From:	Alexey Dobriyan <adobriyan@...il.com>
To:	akpm@...ux-foundation.org
Cc:	linux-kernel@...r.kernel.org, adobriyan@...il.com
Subject: [PATCH 10/52] kstrtox: convert drivers/acpi/


Signed-off-by: Alexey Dobriyan <adobriyan@...il.com>
---
 drivers/acpi/acpi_pad.c    |   27 ++++++++++++++++++---------
 drivers/acpi/power_meter.c |   16 +++++++---------
 2 files changed, 25 insertions(+), 18 deletions(-)

diff --git a/drivers/acpi/acpi_pad.c b/drivers/acpi/acpi_pad.c
index 6afceb3..20d1c2d 100644
--- a/drivers/acpi/acpi_pad.c
+++ b/drivers/acpi/acpi_pad.c
@@ -284,9 +284,12 @@ static uint32_t acpi_pad_idle_cpus_num(void)
 static ssize_t acpi_pad_rrtime_store(struct device *dev,
 	struct device_attribute *attr, const char *buf, size_t count)
 {
-	unsigned long num;
-	if (strict_strtoul(buf, 0, &num))
-		return -EINVAL;
+	unsigned int num;
+	int rv;
+
+	rv = kstrtouint(buf, 0, &num);
+	if (rv < 0)
+		return rv;
 	if (num < 1 || num >= 100)
 		return -EINVAL;
 	mutex_lock(&isolated_cpus_lock);
@@ -307,9 +310,12 @@ static DEVICE_ATTR(rrtime, S_IRUGO|S_IWUSR,
 static ssize_t acpi_pad_idlepct_store(struct device *dev,
 	struct device_attribute *attr, const char *buf, size_t count)
 {
-	unsigned long num;
-	if (strict_strtoul(buf, 0, &num))
-		return -EINVAL;
+	unsigned int num;
+	int rv;
+
+	rv = kstrtouint(buf, 0, &num);
+	if (rv < 0)
+		return rv;
 	if (num < 1 || num >= 100)
 		return -EINVAL;
 	mutex_lock(&isolated_cpus_lock);
@@ -330,9 +336,12 @@ static DEVICE_ATTR(idlepct, S_IRUGO|S_IWUSR,
 static ssize_t acpi_pad_idlecpus_store(struct device *dev,
 	struct device_attribute *attr, const char *buf, size_t count)
 {
-	unsigned long num;
-	if (strict_strtoul(buf, 0, &num))
-		return -EINVAL;
+	unsigned int num;
+	int rv;
+
+	rv = kstrtouint(buf, 0, &num);
+	if (rv < 0)
+		return rv;
 	mutex_lock(&isolated_cpus_lock);
 	acpi_pad_idle_cpus(num);
 	mutex_unlock(&isolated_cpus_lock);
diff --git a/drivers/acpi/power_meter.c b/drivers/acpi/power_meter.c
index 66f6729..a468c33 100644
--- a/drivers/acpi/power_meter.c
+++ b/drivers/acpi/power_meter.c
@@ -166,12 +166,12 @@ static ssize_t set_avg_interval(struct device *dev,
 	union acpi_object arg0 = { ACPI_TYPE_INTEGER };
 	struct acpi_object_list args = { 1, &arg0 };
 	int res;
-	unsigned long temp;
+	u64 temp;
 	unsigned long long data;
 	acpi_status status;
 
-	res = strict_strtoul(buf, 10, &temp);
-	if (res)
+	res = kstrtou64(buf, 10, &temp);
+	if (res < 0)
 		return res;
 
 	if (temp > resource->caps.max_avg_interval ||
@@ -241,8 +241,8 @@ static ssize_t set_cap(struct device *dev, struct device_attribute *devattr,
 	unsigned long long data;
 	acpi_status status;
 
-	res = strict_strtoul(buf, 10, &temp);
-	if (res)
+	res = kstrtoul(buf, 10, &temp);
+	if (res < 0)
 		return res;
 
 	temp /= 1000;
@@ -311,13 +311,11 @@ static ssize_t set_trip(struct device *dev, struct device_attribute *devattr,
 	int res;
 	unsigned long temp;
 
-	res = strict_strtoul(buf, 10, &temp);
-	if (res)
+	res = kstrtoul(buf, 10, &temp);
+	if (res < 0)
 		return res;
 
 	temp /= 1000;
-	if (temp < 0)
-		return -EINVAL;
 
 	mutex_lock(&resource->lock);
 	resource->trip[attr->index - 7] = temp;
-- 
1.7.3.4

--
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