Skip to content

Commit

Permalink
sel_write_validatetrans(): don't open-code memdup_user_nul()
Browse files Browse the repository at this point in the history
Signed-off-by: Al Viro <[email protected]>
  • Loading branch information
Al Viro committed May 26, 2017
1 parent 2ea659a commit 0b884d2
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions security/selinux/selinuxfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -656,14 +656,12 @@ static ssize_t sel_write_validatetrans(struct file *file,
if (*ppos != 0)
goto out;

rc = -ENOMEM;
req = kzalloc(count + 1, GFP_KERNEL);
if (!req)
goto out;

rc = -EFAULT;
if (copy_from_user(req, buf, count))
req = memdup_user_nul(buf, count);
if (IS_ERR(req)) {
rc = PTR_ERR(req);
req = NULL;
goto out;
}

rc = -ENOMEM;
oldcon = kzalloc(count + 1, GFP_KERNEL);
Expand Down

0 comments on commit 0b884d2

Please sign in to comment.