[RFC PATCH 3/5] audit: don't use simple_strtol() anymore

Paul Moore pmoore at redhat.com
Fri Sep 1 13:44:51 UTC 2017


From: Paul Moore <paul at paul-moore.com>

The simple_strtol() function is deprecated, use kstrtol() instead.

Signed-off-by: Paul Moore <paul at paul-moore.com>
---
 kernel/audit.c |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/kernel/audit.c b/kernel/audit.c
index de8a9b8465ae..9df2ef4d3e53 100644
--- a/kernel/audit.c
+++ b/kernel/audit.c
@@ -1566,8 +1566,13 @@ postcore_initcall(audit_init);
 /* Process kernel command-line parameter at boot time.  audit=0 or audit=1. */
 static int __init audit_enable(char *str)
 {
-	audit_default = !!simple_strtol(str, NULL, 0);
-	if (!audit_default)
+	long val;
+
+	if (kstrtol(str, 0, &val))
+		panic("audit: invalid 'audit' parameter value (%s)\n", str);
+	audit_default = (val ? AUDIT_ON : AUDIT_OFF);
+
+	if (audit_default == AUDIT_OFF)
 		audit_initialized = AUDIT_DISABLED;
 	audit_enabled = audit_default;
 	audit_ever_enabled = !!audit_enabled;




More information about the Linux-audit mailing list