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:	Sun,  5 Dec 2010 19:49:01 +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 04/45] kstrtox: convert kernel/


Signed-off-by: Alexey Dobriyan <adobriyan@...il.com>
---
 kernel/gcov/fs.c    |    5 +----
 kernel/ksysfs.c     |    5 +++--
 kernel/params.c     |   24 +++++++++++-------------
 kernel/power/main.c |    8 +++++---
 4 files changed, 20 insertions(+), 22 deletions(-)

diff --git a/kernel/gcov/fs.c b/kernel/gcov/fs.c
index 9bd0934..347c2b3 100644
--- a/kernel/gcov/fs.c
+++ b/kernel/gcov/fs.c
@@ -72,13 +72,10 @@ static int gcov_persist = 1;
 
 static int __init gcov_persist_setup(char *str)
 {
-	unsigned long val;
-
-	if (strict_strtoul(str, 0, &val)) {
+	if (kstrtoint(str, 0, &gcov_persist) < 0) {
 		pr_warning("invalid gcov_persist parameter '%s'\n", str);
 		return 0;
 	}
-	gcov_persist = val;
 	pr_info("setting gcov_persist to %d\n", gcov_persist);
 
 	return 1;
diff --git a/kernel/ksysfs.c b/kernel/ksysfs.c
index 0b624e7..b0b4681 100644
--- a/kernel/ksysfs.c
+++ b/kernel/ksysfs.c
@@ -112,8 +112,9 @@ static ssize_t kexec_crash_size_store(struct kobject *kobj,
 	unsigned long cnt;
 	int ret;
 
-	if (strict_strtoul(buf, 0, &cnt))
-		return -EINVAL;
+	ret = kstrtoul(buf, 0, &cnt);
+	if (ret < 0)
+		return ret;
 
 	ret = crash_shrink_memory(cnt);
 	return ret < 0 ? ret : count;
diff --git a/kernel/params.c b/kernel/params.c
index 08107d1..7c3ecec 100644
--- a/kernel/params.c
+++ b/kernel/params.c
@@ -218,16 +218,14 @@ int parse_args(const char *name,
 }
 
 /* Lazy bastard, eh? */
-#define STANDARD_PARAM_DEF(name, type, format, tmptype, strtolfn)      	\
+#define STANDARD_PARAM_DEF(name, type, format, strtolfn)		\
 	int param_set_##name(const char *val, const struct kernel_param *kp) \
 	{								\
-		tmptype l;						\
 		int ret;						\
 									\
-		ret = strtolfn(val, 0, &l);				\
-		if (ret == -EINVAL || ((type)l != l))			\
-			return -EINVAL;					\
-		*((type *)kp->arg) = l;					\
+		ret = strtolfn(val, 0, (type *)kp->arg);		\
+		if (ret < 0)						\
+			return ret;					\
 		return 0;						\
 	}								\
 	int param_get_##name(char *buffer, const struct kernel_param *kp) \
@@ -243,13 +241,13 @@ int parse_args(const char *name,
 	EXPORT_SYMBOL(param_ops_##name)
 
 
-STANDARD_PARAM_DEF(byte, unsigned char, "%c", unsigned long, strict_strtoul);
-STANDARD_PARAM_DEF(short, short, "%hi", long, strict_strtol);
-STANDARD_PARAM_DEF(ushort, unsigned short, "%hu", unsigned long, strict_strtoul);
-STANDARD_PARAM_DEF(int, int, "%i", long, strict_strtol);
-STANDARD_PARAM_DEF(uint, unsigned int, "%u", unsigned long, strict_strtoul);
-STANDARD_PARAM_DEF(long, long, "%li", long, strict_strtol);
-STANDARD_PARAM_DEF(ulong, unsigned long, "%lu", unsigned long, strict_strtoul);
+STANDARD_PARAM_DEF(byte, u8, "%c", kstrtou8);
+STANDARD_PARAM_DEF(short, s16, "%hi", kstrtos16);
+STANDARD_PARAM_DEF(ushort, u16, "%hu", kstrtou16);
+STANDARD_PARAM_DEF(int, int, "%i", kstrtoint);
+STANDARD_PARAM_DEF(uint, unsigned int, "%u", kstrtouint);
+STANDARD_PARAM_DEF(long, long, "%li", kstrtol);
+STANDARD_PARAM_DEF(ulong, unsigned long, "%lu", kstrtoul);
 
 int param_set_charp(const char *val, const struct kernel_param *kp)
 {
diff --git a/kernel/power/main.c b/kernel/power/main.c
index 7b5db6a..c53c77e 100644
--- a/kernel/power/main.c
+++ b/kernel/power/main.c
@@ -56,10 +56,12 @@ static ssize_t pm_async_show(struct kobject *kobj, struct kobj_attribute *attr,
 static ssize_t pm_async_store(struct kobject *kobj, struct kobj_attribute *attr,
 			      const char *buf, size_t n)
 {
-	unsigned long val;
+	unsigned int val;
+	int rv;
 
-	if (strict_strtoul(buf, 10, &val))
-		return -EINVAL;
+	rv = kstrtouint(buf, 10, &val);
+	if (rv < 0)
+		return rv;
 
 	if (val > 1)
 		return -EINVAL;
-- 
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