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>] [day] [month] [year] [list]
Date:	Fri, 24 Jul 2015 09:51:57 -0700
From:	Guenter Roeck <linux@...ck-us.net>
To:	"Rafael J. Wysocki" <rjw@...ysocki.net>
Cc:	Len Brown <lenb@...nel.org>, Robert Moore <robert.moore@...el.com>,
	Lv Zheng <lv.zheng@...el.com>, linux-acpi@...r.kernel.org,
	linux-kernel@...r.kernel.org, devel@...ica.org,
	Guenter Roeck <linux@...ck-us.net>
Subject: [PATCH] acpi: Use kstrtoul() instead of strtoul()/simple_strtoul()

simple_strtoul() is deprecated; replace with kstrtoul().
Return an error if the value passed to the sysfs attribute
is not a number.

Drop the definition of strtoul() since it is no longer needed.

Signed-off-by: Guenter Roeck <linux@...ck-us.net>
---
 drivers/acpi/sysfs.c            | 8 ++++++--
 include/acpi/platform/aclinux.h | 1 -
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/acpi/sysfs.c b/drivers/acpi/sysfs.c
index 0876d77b3206..d6ea5712ec57 100644
--- a/drivers/acpi/sysfs.c
+++ b/drivers/acpi/sysfs.c
@@ -616,8 +616,12 @@ static ssize_t counter_set(struct kobject *kobj,
 			all_counters[index].count = tmp;
 		else
 			result = -EINVAL;
-	} else
-		all_counters[index].count = strtoul(buf, NULL, 0);
+	} else {
+		if (!kstrtoul(buf, 0, &tmp))
+			all_counters[index].count = tmp;
+		else
+			result = -EINVAL;
+	}
 
 	if (ACPI_FAILURE(result))
 		result = -EINVAL;
diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h
index 74ba46c8157a..9925c1d5d58f 100644
--- a/include/acpi/platform/aclinux.h
+++ b/include/acpi/platform/aclinux.h
@@ -119,7 +119,6 @@
 
 #define ACPI_MACHINE_WIDTH          BITS_PER_LONG
 #define ACPI_EXPORT_SYMBOL(symbol)  EXPORT_SYMBOL(symbol);
-#define strtoul                     simple_strtoul
 
 #define acpi_cache_t                        struct kmem_cache
 #define acpi_spinlock                       spinlock_t *
-- 
2.1.0

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