Commit 63e24c49 authored by Markus Elfring's avatar Markus Elfring Committed by Casey Schaufler

Smack: Use memdup_user() rather than duplicating its implementation

Reuse existing functionality from memdup_user() instead of keeping
duplicate source code.

This issue was detected by using the Coccinelle software.
Signed-off-by: default avatarMarkus Elfring <elfring@users.sourceforge.net>
Acked-by: default avatarCasey Schaufler <casey@schaufler-ca.com>
parent 29b4817d
...@@ -2523,14 +2523,9 @@ static ssize_t smk_write_revoke_subj(struct file *file, const char __user *buf, ...@@ -2523,14 +2523,9 @@ static ssize_t smk_write_revoke_subj(struct file *file, const char __user *buf,
if (count == 0 || count > SMK_LONGLABEL) if (count == 0 || count > SMK_LONGLABEL)
return -EINVAL; return -EINVAL;
data = kzalloc(count, GFP_KERNEL); data = memdup_user(buf, count);
if (data == NULL) if (IS_ERR(data))
return -ENOMEM; return PTR_ERR(data);
if (copy_from_user(data, buf, count) != 0) {
rc = -EFAULT;
goto out_data;
}
cp = smk_parse_smack(data, count); cp = smk_parse_smack(data, count);
if (IS_ERR(cp)) { if (IS_ERR(cp)) {
......
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