Skip to contentSkip to conversation

x86: kernel/check.c simple_strtoul cleanup

PATCH RESEND Superseded Shuah Khan 1 participant 3 messages May 6, 2012 – May 16, 2012 x86

lore
Share & tools
lore

Shuah Khan

author
#0 lore raw

PATCH RESEND 1/1 x86: kernel/check.c simple_strtoul cleanup

Change set_corruption_check() and set_corruption_check_period() in kernel/check.c to call kstrtoul() instead of calling obsoleted simple_strtoul().

---
 arch/x86/kernel/check.c |   20 ++++++++++++++------
 1 files changed, 14 insertions(+), 6 deletions(-)
arch/x86/kernel/check.c +14 -6
index 5da1269..e2dbcb7 100644
@@ -27,21 +27,29 @@ static int num_scan_areas;
 
 static __init int set_corruption_check(char *arg)
 {
-	char *end;
+	ssize_t ret;
+	unsigned long val;
 
-	memory_corruption_check = simple_strtol(arg, &end, 10);
+	ret = kstrtoul(arg, 10, &val);
+	if (ret)
+		return ret;
 
-	return (*end == 0) ? 0 : -EINVAL;
+	memory_corruption_check = val;
+	return 0;
 }
 early_param("memory_corruption_check", set_corruption_check);
 
 static __init int set_corruption_check_period(char *arg)
 {
-	char *end;
+	ssize_t ret;
+	unsigned long val;
 
-	corruption_check_period = simple_strtoul(arg, &end, 10);
+	ret = kstrtoul(arg, 10, &val);
+	if (ret)
+		return ret;
 
-	return (*end == 0) ? 0 : -EINVAL;
+	corruption_check_period = val;
+	return 0;
 }
 early_param("memory_corruption_check_period", set_corruption_check_period);
 
Signature · 1 line
1.7.5.4
author
#1 lore raw
Quoted 3 lines · Shuah Khan

Change set_corruption_check() and set_corruption_check_period() in kernel/check.c to call kstrtoul() instead of calling obsoleted simple_strtoul().

How about this patch? Are you not interested in this type of cleanup patches? Looking for some feedback so I can spend my energies on something that would be worth while in the future :)

-- Shuah

Quoted 47 lines
---
 arch/x86/kernel/check.c |   20 ++++++++++++++------
 1 files changed, 14 insertions(+), 6 deletions(-)
arch/x86/kernel/check.c +14 -6
index 5da1269..e2dbcb7 100644
@@ -27,21 +27,29 @@ static int num_scan_areas;
 
 static __init int set_corruption_check(char *arg)
 {
-	char *end;
+	ssize_t ret;
+	unsigned long val;
 
-	memory_corruption_check = simple_strtol(arg, &end, 10);
+	ret = kstrtoul(arg, 10, &val);
+	if (ret)
+		return ret;
 
-	return (*end == 0) ? 0 : -EINVAL;
+	memory_corruption_check = val;
+	return 0;
 }
 early_param("memory_corruption_check", set_corruption_check);
 
 static __init int set_corruption_check_period(char *arg)
 {
-	char *end;
+	ssize_t ret;
+	unsigned long val;
 
-	corruption_check_period = simple_strtoul(arg, &end, 10);
+	ret = kstrtoul(arg, 10, &val);
+	if (ret)
+		return ret;
 
-	return (*end == 0) ? 0 : -EINVAL;
+	corruption_check_period = val;
+	return 0;
 }
 early_param("memory_corruption_check_period", set_corruption_check_period);
 
#2 lore raw
In reply to Shuah Khan
Commit-ID:  5abe68e493e5aea1ccfc384092f8e98a542b336a
Gitweb:     http://git.kernel.org/tip/5abe68e493e5aea1ccfc384092f8e98a542b336a
Author:     Shuah Khan <[email protected]>
AuthorDate: Sun, 6 May 2012 11:55:08 -0600
Committer:  H. Peter Anvin <[email protected]>
CommitDate: Tue, 15 May 2012 15:36:41 -0700

x86: kernel/check.c simple_strtoul cleanup

Change set_corruption_check() and set_corruption_check_period() in kernel/check.c to call kstrtoul() instead of calling obsoleted simple_strtoul().

---
 arch/x86/kernel/check.c |   20 ++++++++++++++------
 1 files changed, 14 insertions(+), 6 deletions(-)
arch/x86/kernel/check.c +14 -6
index 5da1269..e2dbcb7 100644
@@ -27,21 +27,29 @@ static int num_scan_areas;
 
 static __init int set_corruption_check(char *arg)
 {
-	char *end;
+	ssize_t ret;
+	unsigned long val;
 
-	memory_corruption_check = simple_strtol(arg, &end, 10);
+	ret = kstrtoul(arg, 10, &val);
+	if (ret)
+		return ret;
 
-	return (*end == 0) ? 0 : -EINVAL;
+	memory_corruption_check = val;
+	return 0;
 }
 early_param("memory_corruption_check", set_corruption_check);
 
 static __init int set_corruption_check_period(char *arg)
 {
-	char *end;
+	ssize_t ret;
+	unsigned long val;
 
-	corruption_check_period = simple_strtoul(arg, &end, 10);
+	ret = kstrtoul(arg, 10, &val);
+	if (ret)
+		return ret;
 
-	return (*end == 0) ? 0 : -EINVAL;
+	corruption_check_period = val;
+	return 0;
 }
 early_param("memory_corruption_check_period", set_corruption_check_period);