aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2017-05-13 18:12:07 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2017-05-25 23:28:36 -0400
commit0b884d25f5212bd0323d179c570962bbf822e330 (patch)
treecb03f328b079e28c0333c3a099e2e9e6bdc1fb0e
parent2ea659a9ef488125eb46da6eb571de5eae5c43f6 (diff)
sel_write_validatetrans(): don't open-code memdup_user_nul()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r--security/selinux/selinuxfs.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/security/selinux/selinuxfs.c b/security/selinux/selinuxfs.c
index 50062e70140d..0940892de84d 100644
--- a/security/selinux/selinuxfs.c
+++ b/security/selinux/selinuxfs.c
@@ -656,14 +656,12 @@ static ssize_t sel_write_validatetrans(struct file *file,
656 if (*ppos != 0) 656 if (*ppos != 0)
657 goto out; 657 goto out;
658 658
659 rc = -ENOMEM; 659 req = memdup_user_nul(buf, count);
660 req = kzalloc(count + 1, GFP_KERNEL); 660 if (IS_ERR(req)) {
661 if (!req) 661 rc = PTR_ERR(req);
662 goto out; 662 req = NULL;
663
664 rc = -EFAULT;
665 if (copy_from_user(req, buf, count))
666 goto out; 663 goto out;
664 }
667 665
668 rc = -ENOMEM; 666 rc = -ENOMEM;
669 oldcon = kzalloc(count + 1, GFP_KERNEL); 667 oldcon = kzalloc(count + 1, GFP_KERNEL);