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: <1448459006-6118-4-git-send-email-clabbe.montjoie@gmail.com>
Date:	Wed, 25 Nov 2015 14:43:25 +0100
From:	LABBE Corentin <clabbe.montjoie@...il.com>
To:	minyard@....org, openipmi-developer@...ts.sourceforge.net
Cc:	LABBE Corentin <clabbe.montjoie@...il.com>,
	linux-kernel@...r.kernel.org
Subject: [PATCH 4/4] ipmi: replace simple_strtoul by kstrtox

The simple_strtoul function is marked as obsolete.
This patch replace it by kstrtoint/kstrtoul.
This will simplify code, since some error case not handled by
simple_strtoul are handled by kstrtox.

Signed-off-by: LABBE Corentin <clabbe.montjoie@...il.com>
---
 drivers/char/ipmi/ipmi_si_intf.c  | 15 ++++++++-------
 drivers/char/ipmi/ipmi_watchdog.c |  8 ++++----
 2 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c
index d1fc200..48bab38 100644
--- a/drivers/char/ipmi/ipmi_si_intf.c
+++ b/drivers/char/ipmi/ipmi_si_intf.c
@@ -1775,17 +1775,17 @@ static int parse_str(const struct hotmod_vals *v, int *val, char *name,
 static int check_hotmod_int_op(const char *curr, const char *option,
 			       const char *name, int *val)
 {
-	char *n;
+	int err;
 
 	if (strcmp(curr, name) == 0) {
 		if (!option) {
 			pr_warn(PFX "No option given for '%s'\n", curr);
 			return -EINVAL;
 		}
-		*val = simple_strtoul(option, &n, 0);
-		if ((*n != '\0') || (*option == '\0')) {
+		err = kstrtoint(option, 0, val);
+		if (err) {
 			pr_warn(PFX "Bad option given for '%s'\n", curr);
-			return -EINVAL;
+			return err;
 		}
 		return 1;
 	}
@@ -1805,7 +1805,7 @@ static int hotmod_handler(const char *val, struct kernel_param *kp)
 {
 	char *str = kstrdup(val, GFP_KERNEL);
 	int  rv;
-	char *next, *curr, *s, *n, *o;
+	char *next, *curr, *s, *o;
 	enum hotmod_op op;
 	enum si_type si_type;
 	int  addr_space;
@@ -1817,6 +1817,7 @@ static int hotmod_handler(const char *val, struct kernel_param *kp)
 	int ipmb;
 	int ival;
 	int len;
+	int err;
 	struct smi_info *info;
 
 	if (!str)
@@ -1862,8 +1863,8 @@ static int hotmod_handler(const char *val, struct kernel_param *kp)
 			*s = '\0';
 			s++;
 		}
-		addr = simple_strtoul(curr, &n, 0);
-		if ((*n != '\0') || (*curr == '\0')) {
+		err = kstrtoul(curr, 0, &addr);
+		if (err) {
 			pr_warn(PFX "Invalid hotmod address '%s'\n", curr);
 			break;
 		}
diff --git a/drivers/char/ipmi/ipmi_watchdog.c b/drivers/char/ipmi/ipmi_watchdog.c
index 096f0ce..2f0d2c4 100644
--- a/drivers/char/ipmi/ipmi_watchdog.c
+++ b/drivers/char/ipmi/ipmi_watchdog.c
@@ -194,15 +194,15 @@ static int start_now;
 
 static int set_param_timeout(const char *val, const struct kernel_param *kp)
 {
-	char *endp;
+	int err;
 	int  l;
 	int  rv = 0;
 
 	if (!val)
 		return -EINVAL;
-	l = simple_strtoul(val, &endp, 0);
-	if (endp == val)
-		return -EINVAL;
+	err = kstrtoint(val, 0, &l);
+	if (err)
+		return err;
 
 	*((int *)kp->arg) = l;
 	if (watchdog_user)
-- 
2.4.10

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