Commit 29707b20 authored by Jingoo Han's avatar Jingoo Han Committed by James Morris

security: replace strict_strto*() with kstrto*()

The usage of strict_strto*() is not preferred, because
strict_strto*() is obsolete. Thus, kstrto*() should be
used.
Signed-off-by: default avatarJingoo Han <jg1.han@samsung.com>
Signed-off-by: default avatarJames Morris <james.l.morris@oracle.com>
parent 923b49ff
...@@ -751,7 +751,7 @@ module_param_named(enabled, apparmor_enabled, bool, S_IRUGO); ...@@ -751,7 +751,7 @@ module_param_named(enabled, apparmor_enabled, bool, S_IRUGO);
static int __init apparmor_enabled_setup(char *str) static int __init apparmor_enabled_setup(char *str)
{ {
unsigned long enabled; unsigned long enabled;
int error = strict_strtoul(str, 0, &enabled); int error = kstrtoul(str, 0, &enabled);
if (!error) if (!error)
apparmor_enabled = enabled ? 1 : 0; apparmor_enabled = enabled ? 1 : 0;
return 1; return 1;
......
...@@ -520,7 +520,7 @@ static int ima_parse_rule(char *rule, struct ima_rule_entry *entry) ...@@ -520,7 +520,7 @@ static int ima_parse_rule(char *rule, struct ima_rule_entry *entry)
break; break;
} }
result = strict_strtoul(args[0].from, 16, result = kstrtoul(args[0].from, 16,
&entry->fsmagic); &entry->fsmagic);
if (!result) if (!result)
entry->flags |= IMA_FSMAGIC; entry->flags |= IMA_FSMAGIC;
...@@ -547,7 +547,7 @@ static int ima_parse_rule(char *rule, struct ima_rule_entry *entry) ...@@ -547,7 +547,7 @@ static int ima_parse_rule(char *rule, struct ima_rule_entry *entry)
break; break;
} }
result = strict_strtoul(args[0].from, 10, &lnum); result = kstrtoul(args[0].from, 10, &lnum);
if (!result) { if (!result) {
entry->uid = make_kuid(current_user_ns(), (uid_t)lnum); entry->uid = make_kuid(current_user_ns(), (uid_t)lnum);
if (!uid_valid(entry->uid) || (((uid_t)lnum) != lnum)) if (!uid_valid(entry->uid) || (((uid_t)lnum) != lnum))
...@@ -564,7 +564,7 @@ static int ima_parse_rule(char *rule, struct ima_rule_entry *entry) ...@@ -564,7 +564,7 @@ static int ima_parse_rule(char *rule, struct ima_rule_entry *entry)
break; break;
} }
result = strict_strtoul(args[0].from, 10, &lnum); result = kstrtoul(args[0].from, 10, &lnum);
if (!result) { if (!result) {
entry->fowner = make_kuid(current_user_ns(), (uid_t)lnum); entry->fowner = make_kuid(current_user_ns(), (uid_t)lnum);
if (!uid_valid(entry->fowner) || (((uid_t)lnum) != lnum)) if (!uid_valid(entry->fowner) || (((uid_t)lnum) != lnum))
......
...@@ -22,7 +22,7 @@ static int __init integrity_audit_setup(char *str) ...@@ -22,7 +22,7 @@ static int __init integrity_audit_setup(char *str)
{ {
unsigned long audit; unsigned long audit;
if (!strict_strtoul(str, 0, &audit)) if (!kstrtoul(str, 0, &audit))
integrity_audit_info = audit ? 1 : 0; integrity_audit_info = audit ? 1 : 0;
return 1; return 1;
} }
......
...@@ -609,7 +609,7 @@ static struct encrypted_key_payload *encrypted_key_alloc(struct key *key, ...@@ -609,7 +609,7 @@ static struct encrypted_key_payload *encrypted_key_alloc(struct key *key,
long dlen; long dlen;
int ret; int ret;
ret = strict_strtol(datalen, 10, &dlen); ret = kstrtol(datalen, 10, &dlen);
if (ret < 0 || dlen < MIN_DATA_SIZE || dlen > MAX_DATA_SIZE) if (ret < 0 || dlen < MIN_DATA_SIZE || dlen > MAX_DATA_SIZE)
return ERR_PTR(-EINVAL); return ERR_PTR(-EINVAL);
......
...@@ -753,7 +753,7 @@ static int getoptions(char *c, struct trusted_key_payload *pay, ...@@ -753,7 +753,7 @@ static int getoptions(char *c, struct trusted_key_payload *pay,
return -EINVAL; return -EINVAL;
break; break;
case Opt_keyhandle: case Opt_keyhandle:
res = strict_strtoul(args[0].from, 16, &handle); res = kstrtoul(args[0].from, 16, &handle);
if (res < 0) if (res < 0)
return -EINVAL; return -EINVAL;
opt->keytype = SEAL_keytype; opt->keytype = SEAL_keytype;
...@@ -782,7 +782,7 @@ static int getoptions(char *c, struct trusted_key_payload *pay, ...@@ -782,7 +782,7 @@ static int getoptions(char *c, struct trusted_key_payload *pay,
return -EINVAL; return -EINVAL;
break; break;
case Opt_pcrlock: case Opt_pcrlock:
res = strict_strtoul(args[0].from, 10, &lock); res = kstrtoul(args[0].from, 10, &lock);
if (res < 0) if (res < 0)
return -EINVAL; return -EINVAL;
opt->pcrlock = lock; opt->pcrlock = lock;
...@@ -820,7 +820,7 @@ static int datablob_parse(char *datablob, struct trusted_key_payload *p, ...@@ -820,7 +820,7 @@ static int datablob_parse(char *datablob, struct trusted_key_payload *p,
c = strsep(&datablob, " \t"); c = strsep(&datablob, " \t");
if (!c) if (!c)
return -EINVAL; return -EINVAL;
ret = strict_strtol(c, 10, &keylen); ret = kstrtol(c, 10, &keylen);
if (ret < 0 || keylen < MIN_KEY_SIZE || keylen > MAX_KEY_SIZE) if (ret < 0 || keylen < MIN_KEY_SIZE || keylen > MAX_KEY_SIZE)
return -EINVAL; return -EINVAL;
p->key_len = keylen; p->key_len = keylen;
......
...@@ -106,7 +106,7 @@ int selinux_enforcing; ...@@ -106,7 +106,7 @@ int selinux_enforcing;
static int __init enforcing_setup(char *str) static int __init enforcing_setup(char *str)
{ {
unsigned long enforcing; unsigned long enforcing;
if (!strict_strtoul(str, 0, &enforcing)) if (!kstrtoul(str, 0, &enforcing))
selinux_enforcing = enforcing ? 1 : 0; selinux_enforcing = enforcing ? 1 : 0;
return 1; return 1;
} }
...@@ -119,7 +119,7 @@ int selinux_enabled = CONFIG_SECURITY_SELINUX_BOOTPARAM_VALUE; ...@@ -119,7 +119,7 @@ int selinux_enabled = CONFIG_SECURITY_SELINUX_BOOTPARAM_VALUE;
static int __init selinux_enabled_setup(char *str) static int __init selinux_enabled_setup(char *str)
{ {
unsigned long enabled; unsigned long enabled;
if (!strict_strtoul(str, 0, &enabled)) if (!kstrtoul(str, 0, &enabled))
selinux_enabled = enabled ? 1 : 0; selinux_enabled = enabled ? 1 : 0;
return 1; return 1;
} }
......
...@@ -54,7 +54,7 @@ unsigned int selinux_checkreqprot = CONFIG_SECURITY_SELINUX_CHECKREQPROT_VALUE; ...@@ -54,7 +54,7 @@ unsigned int selinux_checkreqprot = CONFIG_SECURITY_SELINUX_CHECKREQPROT_VALUE;
static int __init checkreqprot_setup(char *str) static int __init checkreqprot_setup(char *str)
{ {
unsigned long checkreqprot; unsigned long checkreqprot;
if (!strict_strtoul(str, 0, &checkreqprot)) if (!kstrtoul(str, 0, &checkreqprot))
selinux_checkreqprot = checkreqprot ? 1 : 0; selinux_checkreqprot = checkreqprot ? 1 : 0;
return 1; return 1;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment